Debian Codegraph @

reply.sh

raw symbols SCIP
1 #!/bin/bash
2 # reply.sh
3
4 # REPLY is the default value for a 'read' command.
5
6 echo
7 echo -n "What is your favorite vegetable? "
8 read
9
10 echo "Your favorite vegetable is $REPLY."
11 # REPLY holds the value of last "read" if and only if
12 #+ no variable supplied.
13
14 echo
15 echo -n "What is your favorite fruit? "
16 read fruit
17 echo "Your favorite fruit is $fruit."
18 echo "but..."
19 echo "Value of \$REPLY is still $REPLY."
20 # $REPLY is still set to its previous value because
21 #+ the variable $fruit absorbed the new "read" value.
22
23 echo
24
25 exit 0