Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Last active March 17, 2019 07:28
Show Gist options
  • Save rms1000watt/d69d0ad657ddcab6b15165edad4b93ee to your computer and use it in GitHub Desktop.
Save rms1000watt/d69d0ad657ddcab6b15165edad4b93ee to your computer and use it in GitHub Desktop.
Main parent bash script to run multiple commands
#!/usr/bin/env bash
NC='\033[0m'
red() { echo -e "\033[0;31m$@${NC}";}
blue() { echo -e "\033[0;96m$@${NC}";}
green() { echo -e "\033[1;32m$@${NC}";}
yellow(){ echo -e "\033[0;33m$@${NC}";}
help() {
red "Usage:
./main.sh func-1 [args]
./main.sh func-2 [args]
"
}
func-1() {
blue "hello func-1: ${@}"
}
func-2() {
green "hello func-2: ${@}"
}
case "$1" in
func-1)
func-1 ${@:2};;
func-2)
func-2 ${@:2};;
*)
help; exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment