[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell Expansion in Bourne Shell Script Question



Karl Vogel <vogelke+debian@pobox.com> wrote:
>      for file in $(ls $MAGDIR/*.[Zz][Ii][Pp] 2> /dev/null); do  ...

mkdir $MAGDIR/silly.zip
touch $MAGDIR/silly.zip/not-a-zip-file

If you're going to insist on using "ls" you should consider "ls -d".

Personally, I'd still go for this construct:

    for FILE in "$MAGDIR"/*.[Zz][Ii][Pp]
    do
        test -f "$FILE" || continue
        ...

But each to our own.
Chris


Reply to: