Last active
December 23, 2020 01:50
-
-
Save goyuninfo/e0275afb2385381483e86ef6a4aeec91 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# get file name only without path | |
file_name=$(basename $BASH_SOURCE) | |
# get extension | |
file_extension="${file_name##*.}" | |
# get file name without extension | |
file="${file_name%.*}" | |
# print them to verify | |
echo "Full input file : $BASH_SOURCE" | |
echo "Filename only : $file_name" | |
echo "File extension only: $file_extension" | |
echo "First part of filename only, without extension: $file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment