Debian Codegraph @

param-sub.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # param-sub.sh
3
4 # Whether a variable has been declared
5 #+ affects triggering of the default option
6 #+ even if the variable is null.
7
8 username0=
9 echoscip-shell system . . echo. "username0 has been declared, but is set to null."
10 echoscip-shell system . . echo. "username0 = ${username0-`whoamiscip-shell system . . whoami.`}"
11 # Will not echo.
12
13 echoscip-shell system . . echo.
14
15 echoscip-shell system . . echo. username1 has not been declared.
16 echoscip-shell system . . echo. "username1 = ${username1-`whoamiscip-shell system . . whoami.`}"
17 # Will echo.
18
19 username2=
20 echoscip-shell system . . echo. "username2 has been declared, but is set to null."
21 echoscip-shell system . . echo. "username2 = ${username2:-`whoamiscip-shell system . . whoami.`}"
22 # ^
23 # Will echo because of :- rather than just - in condition test.
24 # Compare to first instance, above.
25
26
27 #
28
29 # Once again:
30
31 variable=
32 # variable has been declared, but is set to null.
33
34 echoscip-shell system . . echo. "${variable-0}" # (no output)
35 echoscip-shell system . . echo. "${variable:-1}" # 1
36 # ^
37
38 unset variable
39
40 echoscip-shell system . . echo. "${variable-2}" # 2
41 echoscip-shell system . . echo. "${variable:-3}" # 3
42
43 exit 0