grep is always recursive
Matthew Flaschen
matthew.flaschen at gatech.edu
Tue Feb 3 00:40:28 UTC 2009
Lorenzo Luengo wrote:
>> It doesn't work because it's a poor script that cannot handle filenames
>> with paths. The script would also fail with:
I know it's a poor script. :) It was meant as a simple proof of
concept. I promise, it's not in production.
>> $ author_from_initials.sh ~/doc/*
You're violated the pre-conditions!
>> But, more importantly, Matthew has misunderstood the proposal. Only
>> filenames starting with a dash are prefixed with a ./ .
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"
> 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.
And you would might be surprised how many "bad" scripts there are.
Matt Flaschen
More information about the ubuntu-users
mailing list