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

22 lines
493 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2004-04-28 12:08:07 +00:00
# Listing the planets.
2001-07-10 14:25:50 +00:00
for planet in Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto
do
2004-04-28 12:08:07 +00:00
echo $planet # Each planet on a separate line.
2001-07-10 14:25:50 +00:00
done
2008-11-23 22:43:47 +00:00
echo; echo
2001-07-10 14:25:50 +00:00
for planet in "Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto"
2006-12-20 21:11:55 +00:00
# All planets on same line.
# Entire 'list' enclosed in quotes creates a single variable.
# Why? Whitespace incorporated into the variable.
2001-07-10 14:25:50 +00:00
do
echo $planet
done
2008-11-23 22:43:47 +00:00
echo; echo "Whoops! Pluto is no longer a planet!"
2001-07-10 14:25:50 +00:00
exit 0