[prev] [index] [next]

Shell Scripts (cont)

Examples:

$ x=1  y=fred
$ echo $x$y
1fred
$ echo $xy        # the aim is to display "1y"

$ echo "$x"y
1y
$ echo ${x}y
1y
$ echo ${j-10}    # give value of j or 10 if no value
10
$ echo ${j=33}    # set j to 33 if no value (and give $j)
33
$ echo ${x:?No Value}   # display "No Value" if $x not set
1
$ echo ${xx:?No Value}  # display "No Value" if $xx not set
-bash: xx: No Value