Debian Codegraph @

ex36.sh

raw symbols SCIP
1 #!/bin/bash
2 # "Reading" variables.
3
4 echo -n "Enter the value of variable 'var1': "
5 # The -n option to echo suppresses newline.
6
7 read var1
8 # Note no '$' in front of var1, since it is being set.
9
10 echo "var1 = $var1"
11
12
13 echo
14
15 # A single 'read' statement can set multiple variables.
16 echo -n "Enter the values of variables 'var2' and 'var3' "
17 echo =n "(separated by a space or tab): "
18 read var2 var3
19 echo "var2 = $var2 var3 = $var3"
20 # If you input only one value,
21 #+ the other variable(s) will remain unset (null).
22
23 exit 0