[net.news.group] bug in SS/US shell-script, posted some months ago

werner@ut-ngp.UUCP (06/10/84)

<this article has a built-in debugger>

a while ago, someone posted the shell-script below to provide the capability
to subscribe or unsubscribe to a news-group with a command.  If you should
ever give the command SS without an argument, your .newsrc will get trashed
completely.  I can't give you a fix, even though I assume it is simple to
the UN*X wizzard, which I am not. (it needs some checking for the presence
of parameters) - but I want to warn you all ASAP, rather than make you wait
until I figure it out with the help of some manuals.

===================== source of US/SS, as posted earlier ====================

case `basename "$0"` in
	SS)	C=":";;
	*)	C="!";;
esac
SEDCMD=`echo $* | sed 's#[^ ][^ ]*#-e "/^&[:!]/s/[:!]/$C/w /dev/tty"#g'`
TMP=/tmp/rc$$
trap "rm $TMP" 2
eval "sed $SEDCMD <${NEWSRC=$HOME/.newsrc} >$TMP"
mv $TMP $NEWSRC

====================== end of US/SS ==========================================