Debian Codegraph @

ex11.sh

raw symbols SCIP
1 #!/bin/bash
2
3 echo
4
5 if test -z "$1"
6 then
7 echo "No command-line arguments."
8 else
9 echo "First command-line argument is $1."
10 fi
11
12 echo
13
14 if /usr/bin/test -z "$1" # Equivalent to "test" builtin.
15 # ^^^^^^^^^^^^^ # Specifying full pathname.
16 then
17 echo "No command-line arguments."
18 else
19 echo "First command-line argument is $1."
20 fi
21
22 echo
23
24 if [ -z "$1" ] # Functionally identical to above code blocks.
25 # if [ -z "$1" should work, but...
26 #+ Bash responds to a missing close-bracket with an error message.
27 then
28 echo "No command-line arguments."
29 else
30 echo "First command-line argument is $1."
31 fi
32
33 echo
34
35
36 if /usr/bin/[ -z "$1" ] # Again, functionally identical to above.
37 # if /usr/bin/[ -z "$1" # Works, but gives an error message.
38 # # Note:
39 # This has been fixed in Bash, version 3.x.
40 then
41 echo "No command-line arguments."
42 else
43 echo "First command-line argument is $1."
44 fi
45
46 echo
47
48 exit 0