Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Exit immediately on invalid options

I'm an unforgiving bastard!
  • Loading branch information...
commit 2654af57c40ee260221fd371da9c1bb8f7c3f0d3 1 parent cc1512e
lolilolicon authored October 21, 2011

Showing 1 changed file with 9 additions and 1 deletion. Show diff stats Hide diff stats

  1. 10  ffcast.bash
10  ffcast.bash
@@ -332,7 +332,7 @@ fi
332 332
 }
333 333
 
334 334
 OPTIND=1
335  
-while getopts 'bhlmpqsvw' opt; do
  335
+while getopts ':bhlmpqsvw' opt; do
336 336
     case $opt in 
337 337
         h)
338 338
             usage 0
@@ -362,6 +362,14 @@ while getopts 'bhlmpqsvw' opt; do
362 362
         v)
363 363
             (( verbosity++ )) || :
364 364
             ;;
  365
+        '?')
  366
+            error "invalid option: \`%s'" "$OPTARG"
  367
+            exit 1
  368
+            ;;
  369
+        ':')
  370
+            error "option requires an argument: \`%s'" "$OPTARG"
  371
+            exit 1
  372
+            ;;
365 373
     esac
366 374
 done
367 375
 shift $(( OPTIND -1 ))

0 notes on commit 2654af5

Please sign in to comment.
Something went wrong with that request. Please try again.