Debian Codegraph @

func-cmdlinearg.sh

raw symbols SCIP
1 #!/bin/bash
2 # func-cmdlinearg.sh
3 # Call this script with a command-line argument,
4 #+ something like $0 arg1.
5
6
7 func ()
8
9 {
10 echo "$1" # Echoes first arg passed to the function.
11 } # Does a command-line arg qualify?
12
13 echo "First call to function: no arg passed."
14 echo "See if command-line arg is seen."
15 func
16 # No! Command-line arg not seen.
17
18 echo "============================================================"
19 echo
20 echo "Second call to function: command-line arg passed explicitly."
21 func $1
22 # Now it's seen!
23
24 exit 0