Created
August 22, 2018 06:26
-
-
Save metalefty/9a444e325a98ad4f11cd01d91978e957 to your computer and use it in GitHub Desktop.
readlink -f の代わり
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GNU/Linux, FreeBSD, macOS それぞれでちゃんと機能する readlink -f の代わり | |
| # 出典: https://github.com/metalefty/lockman/blob/master/lockman.sh#L203 | |
| absolute_path() | |
| { | |
| echo $(cd $(dirname $1) && pwd)/$(basename $1) | |
| } | |
| # これを | |
| # | |
| # absolute_path ./foo.sh | |
| # | |
| # のように呼び出すとフルパスが返ります。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment