2001-07-10 14:25:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
var1=unset
|
|
|
|
previous=$var1
|
|
|
|
|
|
|
|
while echo "previous-variable = $previous"
|
|
|
|
echo
|
|
|
|
previous=$var1
|
2002-04-01 16:04:17 +00:00
|
|
|
[ "$var1" != end ] # Keeps track of what $var1 was previously.
|
2012-11-27 14:56:18 +00:00
|
|
|
# Four conditions on *while*, but only the final one controls loop.
|
2001-07-10 14:25:50 +00:00
|
|
|
# The *last* exit status is the one that counts.
|
|
|
|
do
|
|
|
|
echo "Input variable #1 (end to exit) "
|
|
|
|
read var1
|
|
|
|
echo "variable #1 = $var1"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Try to figure out how this all works.
|
|
|
|
# It's a wee bit tricky.
|
|
|
|
|
|
|
|
exit 0
|