Preparing Files for Extraction

Gene Spafford spaf at gatech.UUCP
Wed Sep 19 23:46:02 AEST 1984


Submission #2.
After my first posting I received a number of suggestions for changes
and enhancements.  Thanks to jpl at allegra, and most especially to
Corey Satten (corey at fluke), I now submit the following for
your consideration and use.

This runs under "csh" but produces shar archives which are
unbundled with "sh".


#! /bin/csh 
# bundle:  group files into distribution package in "shar" format
#          suitable for extraction with sh, not csh.
#

set command = $0
set errors = 0

if (! ${#argv}) then
	echo "usage: $command:t file1 file2 file3 ... fileN > file.shar"
	exit 1
	endif

echo ': to unbundle, "sh" this file -- DO NOT use csh'
echo ':  SHAR archive format.  Archive created '`date`

foreach file ($argv)
	if (! (-r $file && -f $file) ) then
		echo $command:t": cannot archive '$file'" > /dev/tty
		@ errors++
		continue
		endif
	echo "echo x - $file:t"
	echo "sed 's/^X//' > $file:t <<'+FUNKY+STUFF+'"
	sed 's/^/X/' $file
	echo "+FUNKY+STUFF+"
	if (-d $file:h) then
		echo "echo '`(cd $file:h; ls -l $file:t)`    (as sent)'"
	else
		echo "echo '`ls -l $file:t`    (as sent)'"
		endif
	ls -l $file | sed \
		-e 's/^.\(...\)\(...\)\(...\).*/u=\1,g=\2,o=\3/' \
		-e 's/-//g' \
		-e 's/.*/chmod & '"$file:t/"
	echo "ls -l $file:t"
	end
echo "exit 0"

exit $errors
-- 
Off the Wall of Gene Spafford
The Clouds Project, School of ICS, Georgia Tech, Atlanta GA 30332
Phone:	(404) 894-6169, (404) 894-6170 [messages]
CSNet:	Spaf @ GATech		ARPA:	Spaf%GATech.CSNet @ CSNet-Relay.ARPA
uucp:	...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!spaf
	...!{rlgvax,sb1,seismo,uf-cgrl,unmvax,ut-sally}!gatech!spaf



More information about the Comp.sources.unix mailing list