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

41 lines
896 B
Bash
Raw Normal View History

2002-07-22 15:12:57 +00:00
#!/bin/bash
2009-01-22 14:43:09 +00:00
# poem.sh: Pretty-prints one of the ABS Guide author's favorite poems.
2002-07-22 15:12:57 +00:00
# Lines of the poem (single stanza).
Line[1]="I do not know which to prefer,"
Line[2]="The beauty of inflections"
Line[3]="Or the beauty of innuendoes,"
Line[4]="The blackbird whistling"
Line[5]="Or just after."
2008-11-23 22:43:47 +00:00
# Note that quoting permits embedding whitespace.
2002-07-22 15:12:57 +00:00
# Attribution.
Attrib[1]=" Wallace Stevens"
Attrib[2]="\"Thirteen Ways of Looking at a Blackbird\""
2003-11-03 16:25:16 +00:00
# This poem is in the Public Domain (copyright expired).
2002-07-22 15:12:57 +00:00
2004-03-15 13:47:54 +00:00
echo
2008-07-20 23:16:47 +00:00
tput bold # Bold print.
2002-07-22 15:12:57 +00:00
for index in 1 2 3 4 5 # Five lines.
do
printf " %s\n" "${Line[index]}"
done
for index in 1 2 # Two attribution lines.
do
printf " %s\n" "${Attrib[index]}"
done
2008-07-20 23:16:47 +00:00
tput sgr0 # Reset terminal.
# See 'tput' docs.
2004-03-15 13:47:54 +00:00
echo
2002-07-22 15:12:57 +00:00
exit 0
2004-04-28 12:08:07 +00:00
# Exercise:
# --------
# Modify this script to pretty-print a poem from a text data file.