In the case of git clone
the way it works is that git
program is executed and clone
is passed to it as a parameter. So, if you have several scripts that should be started in a similar manner, you can create a small launcher. This code is in bash(but the script is sh
compatible, so you can safely change the shebang to /bin/sh
). It is very easy to write the same thing in any other language.
#!/bin/bash
command=$1
shift
case $1 in
cmd1)
echo "Executing command #1"
./smallcmd1 "$@"
;;
cmd2)
echo "Executing command $command"
./smallcmd2 "$@"
;;
'')
echo 'No option specified'
exit 1
;;
*) echo "Invalid option"
exit 1
;;
esac
exit $?
Where smallcmd
s are your secondary command scripts or programs.
Now you can execute it:
./mycommand smallcmd1
Additional parameters can be passed as well.
If you place this script into any $PATH directory then you can omit ./
like so:
mycommand smallcmd1