On Fri, Apr 08, 2011 at 07:43:38AM -0600, Stuart Jansen wrote: > On Thu, 2011-04-07 at 22:48 -0600, Aaron Toponce wrote: > > Yet another reason to quit using Bash- it teaches you bad habits! > > > scp user@server:/testfoo user@server:/testbar user@server:/testbaz . > > Oh come off it. How many people have files names "user@server:/testfoo" > on their system? Especially considering that your exact example would > require a directory named "user@server:" before there'd be a problem.
I agree that Aaron's example was a little contrived, and the tone was a little preachy, but I have had cases where the bourne-style globbing behavior got me into minor trouble. Here is an example that is similar to the real-life situations I've run into: find . -name hello*.txt This command recursively searches for a file whose name matches the given pattern. However, the behavior depends entirely on whether the current directory contains a file matching the pattern. For example, if there is a file called hello42.txt, then the find will recursively search for all files named exactly hello42.txt. But if the current directory does not have any such files, then the find will recursively search for any files matching hello*.txt. > > ZSH will teach you proper quoting and file globbing, something you've > > easily taken for granted in Bash. :) The situation I described above can occur with any command like find or grep, which internally process globs. I have to agree with Aaron that the ZSH-style globbing default can help set up good habits to avoid such situations. But for commands like wget and scp, it's very rarely a problem. Which globbing behavior you choose to go with is a matter of personal preference, but it's good for everyone to be aware of some of the subtle problems that can occur when using globbing. -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868 -------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
