Advertisement
quantumech

Untitled

May 10th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Do different things depending on input from first argument when script was called.
  4. case $1 in
  5.     "Value" ) # If $1 = "Value"
  6.         echo "First case" ;;
  7.     [a-z] ) # If $1 = any value from a to z
  8.         echo "Second case" ;;
  9.     [1-9] ) # If $1 = any value from 1 to 9
  10.         echo "Third case" ;;
  11.     Value_* ) # If $1 = Value_<anything>
  12.         echo "Fourth case" ;;
  13.     ? ) # If $1 = Any single character
  14.         echo "Fifth case" ;;
  15.     * ) # Default case
  16.         echo "Sixth case" ;;
  17. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement