| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # reply.sh |
| 3 | |
| 4 | # REPLY is the default value for a 'read' command. |
| 5 | |
| 6 | echoscip-shell system . . echo. |
| 7 | echoscip-shell system . . echo. -n "What is your favorite vegetable? " |
| 8 | read |
| 9 | |
| 10 | echoscip-shell system . . echo. "Your favorite vegetable is $REPLY." |
| 11 | # REPLY holds the value of last "read" if and only if |
| 12 | #+ no variable supplied. |
| 13 | |
| 14 | echoscip-shell system . . echo. |
| 15 | echoscip-shell system . . echo. -n "What is your favorite fruit? " |
| 16 | read fruit |
| 17 | echoscip-shell system . . echo. "Your favorite fruit is $fruit." |
| 18 | echoscip-shell system . . echo. "but..." |
| 19 | echoscip-shell system . . 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 | echoscip-shell system . . echo. |
| 24 | |
| 25 | exit 0 |