Guest User

Untitled

a guest
Dec 6th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.64 KB | None | 0 0
  1. #!/usr/bin/bash
  2. # Note, "[[ ]]" and "if [] && []" is bash/ksh88 ONLY
  3.  
  4. if [ -z ${1} ]; then tweetnum=1
  5. elif [[ ${1} =~ ^[0-9]+$ ]] ; then
  6.         if [ ${1} -gt 0 ] && [ ${1} -lt 11 ]; then tweetnum=$1
  7.         else echo "Number outside of range 1..10"; exit 0;
  8.         fi  
  9. else echo "That's not a number. Please use a number in the range 1..10"; exit 0;
  10. fi
  11.                                                                                                                                                                                                                                                                          
  12. echo "Tweet # ${tweetnum}"
Add Comment
Please, Sign In to add comment