Re: Shell Archive
Posted in 1992
I attach a shell archive of the shell archiver I usually use. There are also C programs which do the same job somewhat quicker, but they are also bigger to send. Note the customisation for the sending organsiation -- you'll want to change that (please!). I hope it's useful. Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h> : "@(#)shar.sh 1.8" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Thu Aug 13 23:05:56 GMT 1992 by johnl at Informix Software Ltd. # Files archived in this archive: # shar # #-------------------- if [ -f shar -a "$1" != "-c" ] then echo shar: shar already exists else echo 'x - shar (Aug characters)' sed -e 's/^X//' >shar <<'SHAR-EOF' X X: "@(#)shar.sh 1.8" X# X# Create shell archive from files listed in argument list X Xcase "$1" in X-s) silent=yes X shift X ;; X--) shift X ;; X-*) echo "Usage: $0 [-s] file ..." >&2 X exit 1 X ;; Xesac X Xcase $# in X0) echo "Usage: $0 [-s] file ..." >&2 X exit 1 X ;; Xesac X Xcat <<! X: "@(#)shar.sh 1.8" X#! /bin/sh X# X# This is a shell archive. X# Remove everything above this line and run sh on the resulting file. X# If this archive is complete, you will see this message at the end: X# "All files extracted" X# X# Created: `date` by $LOGNAME at Informix Software Ltd. X# Files archived in this archive: X! X Xfor file in "$@" Xdo X if [ -f $file -a -r $file ] X then X echo "# $file" X fi Xdone Xecho "#" X Xfor file in "$@" Xdo X if [ ! -f $file ] X then X echo "$0: $file is not a file" >&2 X continue X fi X bname=`basename $file` X if [ "$silent" != yes ] X then X echo "a - $bname" >&2 X fi X if [ ! -r $file ] X then X echo "$0: Can't read $file" >&2 X exit 1 X else X size=`ls -l $file | sed 's/[ ][ ]*/ /g' | cut -f5` X echo "#--------------------" X echo "if [ -f $bname -a \\"\\$1\\" != \\"-c\\" ]" X echo "then echo shar: $bname already exists" X echo "else" X echo "echo 'x - $bname ($size characters)'" X echo "sed -e 's/^X//' >$bname <<'SHAR-EOF'" X sed -e 's/^/X/' $file X echo "SHAR-EOF" X echo "if [ \\`wc -c <$bname\\` -ne $size ]" X echo "then echo shar: $bname unpacked with wrong size" X echo "fi" X echo "# end of overwriting check" X echo "fi" X fi Xdone Xecho "echo All files extracted" Xecho "exit 0" SHAR-EOF if [ `wc -c <shar` -ne Aug ] then echo shar: shar unpacked with wrong size fi # end of overwriting check fi echo All files extracted exit 0