Skip to content

Instantly share code, notes, and snippets.

@ilg-ul
Last active September 10, 2017 20:32
Show Gist options
  • Save ilg-ul/fb8dcded6ff69a7c9f7ddce4337e242b to your computer and use it in GitHub Desktop.
Save ilg-ul/fb8dcded6ff69a7c9f7ddce4337e242b to your computer and use it in GitHub Desktop.
Sequence to set the current folder.
# Include this part after the bash-init.sh part
script_path="$0"
if [[ "${script_path}" != /* ]]
then
# Make relative path absolute.
script_path="$(pwd)/$0"
fi
script_folder="$(dirname ${script_path})"
# echo "$script_folder"
script_name="$(basename $0)"
# echo "${script_name}"
cd "$(dirname "${script_folder}")"
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment