copying files

John Veregge john at nereid.jpl.nasa.gov
Tue Dec 11 06:59:21 AEST 1990


In article <24 at kaspar.UUCP>, ires at kaspar.UUCP (Bruce R. Larson) writes:
|> In article <1990Dec6.230153.14856 at wpi.WPI.EDU>, fenn at wpi.WPI.EDU (Brian Fennell) writes:
|> > In article <169 at raysnec.UUCP> shwake at raysnec.UUCP (Ray Shwake) writes:
|> > >rouben at math13.math.umbc.edu (Rouben Rostamian) writes:
|> > >
|> > >>In article <1990Dec5.021951.28104 at en.ecn.purdue.edu> nichols at en.ecn.purdue.edu (Scott P Nichols) writes:
|> > >>|
|> > >>|Do any of you UNIX wizards know how to even list all of
|> > >>|the names of the files which begin '.' (besides, of course
|> > >>|the files in the root (second line of list) 
|> > >>|
|> > 
|> > ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
|> > 
|> > sheeeeeesh
|> 
|> Are you guys still talking about this?  Sheeeesh indeed!
|> 
|> Sorry Brian, but did you try your solution?  It lists both `.' and `..'.
|> 
|> 
|> 
|> The fellow who suggested `ls -ld .*' gave the best non-pipe solution to date.
|> You can get rid of the `.' entry by listing filenames with at least 2 chars.
|> 
|>    ls -ld .?*
|> 
|> The only undesirable entry remaining is `..'.
|> 
|> 
|> If you absolutely *have* to get rid of the `..' you can do this:
|> 
|>     /bin/ls -ld .?* | grep -v ' \.\.$'
|> 
|> [NOTE:  Use /bin/ls or equivalent to avoid aliased ls's and locally
|>         modified ls's.]
|> 
|> If we don't put this one rest soon we'll start getting awk and perl and
|> who-knows-what-else solutions.
|> 
|> B

I have found the following work quite well ... (But alas, I never tried them
on anything but our Suns.)

	sh:	echo .[!.]*		OR	ls -ad .[!.]*
	csh:	echo .[\ --/-~]*	OR	ls -ad .[\ --/-~]*

	The bourne shell allows an enclosed pattern specification of
	"any character but these" with [! ... ]. The c shell apparently
	does not (and I looked real hard {-:).

	The c shell enclosed pattern specification is "any character from
	the space (escaped) character to the minus sign character OR from
	the slash character to the tilde character." The specification is
	missing only one ascii printing character, the period character.

-- 
John R Veregge                 Section 348 - Flight Command and Data
Jet Propulsion Laboratory      Management (Technology Development)
Calif Institute of Technology  Mail stop: T1704, Office: T1704-P
4800 Oak Grove Drive           Phone: (818) 354-0511, FAX: 393-4494
Pasadena, CA, USA 91109        john at triton.jpl.nasa.gov



More information about the Comp.unix.shell mailing list