grep is always recursive
Cameron Hutchison
lists at xdna.net
Tue Feb 3 01:06:19 UTC 2009
Matthew Flaschen <matthew.flaschen at gatech.edu> writes:
>You're right. I did miss that. However, the script could easily be
>changed to still not work. :)
>#!/bin/sh
>for filename in "$@"
>do
> echo -n "$filename: "
> case $filename in
> -JES*)
> echo "John Edwards Smith"
> ;;
> -MJT*)
> echo "Mary Jane Thompson"
> ;;
> *)
> echo "Author not found";
> ;;
> esac
>done
>(file should now be named "-JES_proposal.txt"
Hmmm, your script shows enough knowledge to iterate arguments with
"$@", but does not use basename(1)? :-) ( <-- dont miss the smiley)
>> Should we file an /enhancement proposal/ to the bash developers??
>>
>> I keep thinking it's a good idea.
>It's not. Yes, you can make a good argument that it only breaks "bad"
>scripts like the one above. But that's still not acceptable. Scripts
>that depend on standard well-defined behavior can't just stop working.
bash already has shell options for dotglob, extglob, failglob,
nocaseglob and nullglob. Adding a dashglob option isn't going to break
anything.
>And you would might be surprised how many "bad" scripts there are.
I'm guessing most scripts are written for /bin/sh. Anything poorly written
for /bin/bash has probably broken multiple times over the years as the
shell has grown with new builtins, parameter expansions, redirections,
etc. Poorly written scripts also probably exhibit dependencies on
undefined behaviour which will have also changed over the years.
I acknowledge that there is some risk. I don't think it's enough to
worry about, but even then you could just have bash default to dashglob
for interactive shells, leaving the default behaviour for scripts.
More information about the ubuntu-users
mailing list