You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
527 B
20 lines
527 B
#!/bin/sh |
|
# |
|
# This is the proverbial 'Hello, world!' script to demonstrate the most basic |
|
# functionality of shFlags. |
|
# |
|
# This script demonstrates accepts a single command-line flag of '-n' (or |
|
# '--name'). If a name is given, it is output, otherwise the default of 'world' |
|
# is output. |
|
|
|
# source shflags |
|
. ../src/shflags |
|
|
|
# define a 'name' command-line string flag |
|
DEFINE_string 'name' 'world' 'name to say hello to' 'n' |
|
|
|
# parse the command-line |
|
FLAGS "$@" || exit 1 |
|
eval set -- "${FLAGS_ARGV}" |
|
|
|
echo "Hello, ${FLAGS_name}!"
|
|
|