Last active
          March 17, 2019 07:28 
        
      - 
      
- 
        Save rms1000watt/d69d0ad657ddcab6b15165edad4b93ee to your computer and use it in GitHub Desktop. 
    Main parent bash script to run multiple commands
  
        
  
    
      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 | |
| 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