Created
August 2, 2019 22:35
-
-
Save shubhamagarwal92/f777e748a0f0df5a39a2477410302be3 to your computer and use it in GitHub Desktop.
Get the file name of running bash script without extension
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
#!/usr/bin/env bash | |
export CURRENT_DIR=${PWD} | |
export PARENT_DIR="$(dirname "$CURRENT_DIR")" | |
echo "File is in: " $CURRENT_DIR | |
# https://stackoverflow.com/questions/192319/how-do-i-know-the-script-file-name-in-a-bash-script | |
export FileNameWithExt=${0##*/} | |
export FILE_NAME=${FileNameWithExt%.*} | |
echo "You are running the file: " $FILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment