Debian Codegraph @

ex15.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Naked variables
3
4 echoscip-shell system . . echo.
5
6 # When is a variable "naked", i.e., lacking the '$' in front?
7 # When it is being assigned, rather than referenced.
8
9 # Assignment
10 a=879
11 echoscip-shell system . . echo. "The value of \"a\" is $a."
12
13 # Assignment using 'let'
14 let a=16+5
15 echoscip-shell system . . echo. "The value of \"a\" is now $a."
16
17 echoscip-shell system . . echo.
18
19 # In a 'for' loop (really, a type of disguised assignment):
20 echoscip-shell system . . echo. -n "Values of \"a\" in the loop are: "
21 for a in 7 8 9 11
22 do
23 echoscip-shell system . . echo. -n "$a "
24 done
25
26 echoscip-shell system . . echo.
27 echoscip-shell system . . echo.
28
29 # In a 'read' statement (also a type of assignment):
30 echoscip-shell system . . echo. -n "Enter \"a\" "
31 read a
32 echoscip-shell system . . echo. "The value of \"a\" is now $a."
33
34 echoscip-shell system . . echo.
35
36 exit 0