LDP/LDP/guide/docbook/abs-guide/ex26.sh

16 lines
420 B
Bash
Raw Permalink Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
echo
2005-06-05 14:39:50 +00:00
# Equivalent to:
2001-09-04 13:27:31 +00:00
while [ "$var1" != "end" ] # while test "$var1" != "end"
2005-06-05 14:39:50 +00:00
do
2001-07-10 14:25:50 +00:00
echo "Input variable #1 (end to exit) "
2001-09-04 13:27:31 +00:00
read var1 # Not 'read $var1' (why?).
2005-06-05 14:39:50 +00:00
echo "variable #1 = $var1" # Need quotes because of "#" . . .
2001-09-04 13:27:31 +00:00
# If input is 'end', echoes it here.
# Does not test for termination condition until top of loop.
2001-07-10 14:25:50 +00:00
echo
done
exit 0