No I did not use
cat. Your use of
cat is very clever, but I just did not think of it because I was refining my script that used
read.
I am writing a little script to automate entries for the forum News section. I use the shell
read to prompt for the title, url and quote.
I did not immediately realize that some news quotes were multiple lines. so I replaced the single read with a shell function that uses multiple
reads. In other words I stayed within the limits of my self-imposed programming paradigm
Code:
#!/bin/sh
pastetext() {
echo Paste text. To end paste, just type a '!' as only text at begin of line .....
while read LINE ; do
if [ "x$LINE" = "x!" ] ; then break ; fi
if [ "x$TEXT" = "x" ]; then
TEXT="$LINE"
else
TEXT="$TEXT\n$LINE"
fi
done
}
cat <<END
Make News for daemonforums.org
------------------------------------------------------------------------
END
printf "\nURL of article/source : "
read URL
printf "\nTitle : "
read TITLE
printf "\nQuotation or description : "
pastetext
echo ================= TEXT to paste =============
echo $TITLE
printf "From [url]$URL[/url]:[quote]$TEXT[/quote]\n"
echo ================= END OF TEXT ===============
# end of script