Created
October 29, 2015 08:39
-
-
Save xeor/111408770b20bc3a2d04 to your computer and use it in GitHub Desktop.
Store the scripts folder in a variable
This file contains 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
#!/bin/bash | |
# Finding out which script-folder your bash-script runs in can be problematic. | |
# Here is a quick solution that tries to be cross-platform and support every odd-cases. Like if your script is runned via a symlink. | |
mydir=$(cd $(dirname $(readlink -f "${BASH_SOURCE:-$0}"));pwd) | |
cd ${mydir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment