1 #!/bin/sh 2 # 3 # This is the proverbial 'Hello, world!' script to demonstrate the most basic 4 # functionality of shFlags. 5 # 6 # This script demonstrates accepts a single command-line flag of '-n' (or 7 # '--name'). If a name is given, it is output, otherwise the default of 'world' 8 # is output. 9 10 # source shflags 11 . ../src/shflags 12 13 # define a 'name' command-line string flag 14 DEFINE_string 'name' 'world' 'name to say hello to' 'n' 15 16 # parse the command-line 17 FLAGS "$@" || exit 1 18 eval set -- "${FLAGS_ARGV}" 19 20 echo "Hello, ${FLAGS_name}!" 21