Idiom for $(ls -d $pattern 2>/dev/null)

Maarten Litmaath maart at cs.vu.nl
Tue Mar 21 13:26:22 AEST 1989


das at lanai.cs.ucla.edu writes:

\Do you have a favorite idiom for (ksh syntax):
\	for f in *
\(Which is not what you really want, since if the directory is empty, f takes on
\the value "*").

set - `
	for i in .* *
	do
		echo "$i"
	done | sed -e '/^\.$/d' -e '/^\.\.$/d'
`
[ -f "$1" ] && {
	for i
	do
		echo "$i"
	done
}
-- 
 Modeless editors and strong typing:   |Maarten Litmaath @ VU Amsterdam:
   both for people with weak memories. |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list