leading comments

Keith Pilotti @shine pilotti at telesoft.UUCP
Thu Aug 29 22:46:02 AEST 1985


In article <6589 at boring.UUCP> ken at mcvax.UUCP (Amoeba #117) writes:
>In article <318 at luke.UUCP> itkin at luke.UUCP (Steven List) writes:
>>I'd like to suggest that when we put some commentary at the beginning,
>>each line be preceded by the shell comment character (#).
>
>This is a repost of a shell script that will solve the problem if every
>shar'ed source has a line beginning with # at the top of the archive.
>From rn I just have to say: "| (cd sourcedir; unshar)".
>

    Starting from Ken's great idea, I fixed up this script which adds:

        o Support for multiple file names
            (eg. "unshar *" for multi-shar postings.)

        o Support for shell archives which begin with a ":"
            (old `unshar' barfs heavily...)

    ***  REPLACE YOUR `unshar' WITH THIS ONE  ***
    (ie.  "|(cd ~/bin;unshar)"  :-)

    /+\ Keith
    ________________________________________________________
    KEITH F. PILOTTI -- TeleSoft         (619) 457-2700 x172
                        10639 Roselle St, SanDiego, CA 92121

          <pilotti at telesoft.UUCP> <pilotti at UCSD.ARPA>
          ...{decvax,ucbvax}!sdcsvax!telesoft!pilotti

#! /bin/sh
cat > unshar << '@END@'
#! /bin/sh
# $Header: RCS/unshar,v 1.1 85/08/27  pilotti Exp $
#
# unshar - pipe shar part of input through sh
#
# Ignore lines before the first
#    "#" or ":" comment starting in the first column.
# Input is either $@ (ie. arg list) or stdin.
#
# NOTE: Non-BSD sites -- ln /bin/test /bin/[
#

if [ "$*" = "" ] 
then
    set - \-
fi

for shar
do
    if [ "$shar" = "-" ]
    then
        shar=""
        echo Unsharing standard-input
    else
        echo Unsharing $shar
    fi
    sed -n '/^[#:]/,$ p' ${shar-} | sh
done

@END@
chmod +x unshar
exit



More information about the Comp.sources.unix mailing list