lsyn - query about dir entries, 'y' -> stdout

Daniel Smith - coming soon to a file near you daniel at island.COM
Sat Jan 12 08:35:45 AEST 1991


	Note: This REQUIRES grabchars.  If you don't have this, get version
1.95 from comp.sources.misc archives worldwide, or directly from me
(the author :-).


	This is a quickie shell script I wrote to use when making
tar tapes or in other situations where I want a subset of files available.
It prompts you for each file, and all the files you answer 'y' to
(you can just hit return for the default) are echoed to stdout.  This
allows you to do things like:

	tar cvf /dev/rst8 `lsyn`

	...which can be more handy/quicker than trying to come up with the
right combination of *, ?. etc....depends on the directory.  Have fun!

				Daniel

[this is 24 lines exactly, might be easiest just to cut and paste]
---cut here ---------------------------
#! /bin/csh -f
#
#	lsyn - ask about each entry in a directory, yes answers go to stdout
#
#	daniel at island.com, January 1991
#
if ($#argv == 0) then
	set files=(*)
else
	set files=($argv[1-$#argv])
endif

set outfiles

while ($#files)
	set a=`grabchars -b -d y -c ynYN -L -r -q "do you want $files[1]? "`
	echo "" > /dev/tty
	if ($a =~ "y") then
		set outfiles=($outfiles $files[1])
	endif
	shift files
end
echo $outfiles | tr ' ' '\012'
---cut here ---------------------------

-- 
daniel at island.com       Daniel Smith, Island Graphics, (415) 491 0765 x 250(w)
daniel at world.std.com      4000 CivicCenterDrive SanRafael MarinCounty CA 94903
dansmith at well.sf.ca.us      Fax: 491 0402 Disclaimer: Hey, I wrote it, not IG!
Go get lunch.  Come back, plug in tape #2 and go to lunch again. -Mike Anderson



More information about the Alt.sources mailing list