Skip to content

Instantly share code, notes, and snippets.

@metalefty
Created August 22, 2018 06:26
Show Gist options
  • Select an option

  • Save metalefty/9a444e325a98ad4f11cd01d91978e957 to your computer and use it in GitHub Desktop.

Select an option

Save metalefty/9a444e325a98ad4f11cd01d91978e957 to your computer and use it in GitHub Desktop.
readlink -f の代わり
# 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