home *** CD-ROM | disk | FTP | other *** search
- From: falk@peregrine.Sun.COM (Ed Falk)
- Newsgroups: alt.sources
- Subject: Re: SHAR - Where is the source ?
- Message-ID: <2046@exodus.Eng.Sun.COM>
- Date: 4 Nov 90 01:30:00 GMT
-
- In article <9010311326.AA02589@w107zrz.zrz.tu-berlin.de> Frank Elsner <elsner@zrz.tu-berlin.de> writes:
- >Where can I get the source of "shar" to be used with INTERACTIVE UNIX ?
- >
- >Unfortunatly "shar" is missing but I need it .
- >
- >Frank Elsner (TUBerlin/ZRZ, Postmaster)
-
-
- "shar" is not part of standard Unix, it's just a utility people
- pass around. There are at least a dozen variations.
-
- Here's the one I use 90% of the time: It doesn't do any of the
- fancy stuff like compressing binary files or building multi-part
- archives, but it works for just packing a bunch of files. It's
- main advantage is that it's a short shell script rather than a
- C program.
-
-
- #! /bin/sh
- # shar <source1> <source2> ... <sourceN> [ > destination ]
-
- echo "#! /bin/sh"
- echo "# this is a shell archive, meaning:"
- echo "# 1. Remove everything above the #! /bin/sh line"
- echo "# 2. Save the resulting text in a file."
- echo "# 3. Execute the file with /bin/sh to create the files:"
- for i in $* ; do
- echo "# $i"
- done
- echo "# This archive created: `date` by $USER"
- echo "#"
- echo "#"
- echo 'export PATH; PATH=/bin:$PATH'
- echo "#"
-
- for i do
- echo a - $i >&2
- echo ""
- len=`wc -c < $i`
- echo "if test -f $i"
- echo "then"
- echo "echo shar: will not over-write existing file $i"
- echo "else"
- echo "echo shar: extracting '$i', $len characters"
- echo "sed 's/^X//' > $i <<'SHAR_EOF'"
- sed 's/^/X/' $i
- echo "SHAR_EOF"
- echo "len=\`wc -c < $i\`"
- echo "if test \$len != $len ; then"
- echo "echo error: $i was \$len bytes long, should have been $len"
- echo "fi"
- echo "fi # end of overwriting check"
- done
- echo "exit 0"
- -ed falk, sun microsystems -- sun!falk, falk@sun.com
- "What are politicians going to tell people when the
- Constitution is gone and we still have a drug problem?"
- -- William Simpson, A.C.L.U.
-