copying files

Chris Torek chris at mimsy.umd.edu
Sat Dec 15 11:47:54 AEST 1990


In an article whose referent was deleted by broken news software, I wrote:
>... If any such files exist, the pattern
>	.[^A--/-^?]
>will match them.  Note: ^A here represents a literal control-A, and
>^? represents either a literal DEL (if you have only 7-bit shells and
>files) or meta-DEL (if you have 8-bit shells and files).

In article <1990Dec07.201727.11006 at Kesa.COM> djc at Kesa.COM (Don Christensen)
writes:
>I typically use .??* because it is the easiest to type and I have rarely
>(never?) come across a two character `.' file.

(I have one, hence some concern. :-) )

>It seems to me, though, that the shortest way to get all `.' files
>excluding `.' and `..' is with the following expression:
>
>ls -d .[^.]*

This does not work, for several reasons:

	- the syntax given (left-bracket caret period right-bracket)
	  only works in POSIXish shells.  Among those excluded are all
	  of the 4BSD and System V shells except *very* recent work.
	  Some System V shells have an alternative syntax ([!.]).

	- It fails to match names like `..gotcha'.


I typically use `.??*', but for reference, the construct

    foo `ls -f | tail +3`

is also useful (provided your `ls' has a `-f'!).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.shell mailing list