SHARE
TWEET

Untitled

quantumech May 10th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top