blob: 84b755ad9425d2e3a1416479c2cd7799495b61f8 [file] [log] [blame]
kate.ward90fd99d2008-06-18 20:51:29 +00001#!/bin/sh
kate.ward120b5042008-06-27 08:58:03 +00002#
kate.ward120b5042008-06-27 08:58:03 +00003# 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.
kate.ward90fd99d2008-06-18 20:51:29 +00009
10# source shflags
11. ../src/shflags
12
13# define a 'name' command-line string flag
14DEFINE_string 'name' 'world' 'name to say hello to' 'n'
15
16# parse the command-line
kate.wardc5210682009-03-30 18:54:36 +000017FLAGS "$@" || exit 1
18eval set -- "${FLAGS_ARGV}"
kate.ward90fd99d2008-06-18 20:51:29 +000019
20echo "Hello, ${FLAGS_name}!"