Debian Codegraph @

ex16.sh

raw symbols SCIP
1 #!/bin/bash
2
3 a=23 # Simple case
4 echo $a
5 b=$a
6 echo $b
7
8 # Now, getting a little bit fancier (command substitution).
9
10 a=`echo Hello!` # Assigns result of 'echo' command to 'a' ...
11 echo $a
12 # Note that including an exclamation mark (!) within a
13 #+ command substitution construct will not work from the command-line,
14 #+ since this triggers the Bash "history mechanism."
15 # Inside a script, however, the history functions are disabled by default.
16
17 a=`ls -l` # Assigns result of 'ls -l' command to 'a'
18 echo $a # Unquoted, however, it removes tabs and newlines.
19 echo
20 echo "$a" # The quoted variable preserves whitespace.
21 # (See the chapter on "Quoting.")
22
23 exit 0