Bash globbing files only?
Daniel Qarras
dqarras at yahoo.com
Wed Jan 31 16:47:42 UTC 2007
Hi!
--- Cameron Simpson <cs at zip.com.au> wrote:
> A POSIX shell requires that the test command supports this:
>
> -h file
> True if file exists and is a symbolic link.
> -L file
> True if file exists and is a symbolic link.
Thanks, I already saw those but initially they did not work for
directories. That was because I had
dirs=[^.]*/
that would expand, e.g:
foo/
bar/
and the trailing slash caused -L test to fail. So, finally, I have what
I wanted without any external commands like this:
dirs=[^.]*/
for d in ${dirs}
do
if [[ -d ${d//\//} && ! -L ${d//\//} ]]
then
echo processing dir $d
fi
done
# ...
files=[^.]*
for f in ${files}
do
if [[ -f ${f//\//} && ! -L ${f//\//} ]]
then
echo processing files $f
fi
done
Thanks!
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
More information about the fedora-list
mailing list