• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
14DEFINE_string 'name' 'world' 'name to say hello to' 'n'
15
16# parse the command-line
17FLAGS "$@" || exit 1
18eval set -- "${FLAGS_ARGV}"
19
20echo "Hello, ${FLAGS_name}!"
21