Skip to content

Instantly share code, notes, and snippets.

@liuyix
Last active December 22, 2015 06:39
Show Gist options
  • Save liuyix/6432518 to your computer and use it in GitHub Desktop.
Save liuyix/6432518 to your computer and use it in GitHub Desktop.
shell script: 返回当前script所在路径,即使是symlink也可以。
#!/bin/bash
# http://stackoverflow.com/a/422123
# http://stackoverflow.com/questions/242538/unix-shell-script-find-out-which-directory-the-script-file-resides
dir=$(dirname $(readlink -f "$BASH_SOURCE"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment