Created
June 8, 2017 23:56
-
-
Save nhatzHK/d68c6b62632ca3d81c7a3fbcbac05521 to your computer and use it in GitHub Desktop.
I was dumb enough to not modify path
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
#!/usr/bin/sh | |
# Execute the script specified as argument | |
# Directory where the script are stored | |
baseDir=/opt/nhatz_bash | |
passed_args=("$@") #list of provided arguments stored in new array | |
comm=$1 #script/command to call, first on the list | |
comm_pos=0 #position of $comm in the array | |
new_args=(${passed_args[@]:0:$comm_pos} ${passed_args[@]:$(($comm_pos + 1 ))}) #list of arguments without $comm | |
if [ -d $baseDir/$comm ]; then | |
$baseDir/$comm/$comm.sh $(echo ${new_args[@]}) | |
else | |
echo "[Nhatz] Unknown commad: $comm" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment