← Back to team overview

ubuntuone-users team mailing list archive

Re: ubuntuone client default folder

 

On Sun, Nov 01, 2009 at 07:45:06PM +0100, Carsten Agger wrote:
> > 
> > how does it break globbing?
> 
> Good question! If you want to do something with all files or directories
> somewhere, you can do something like this in bash:
> 
> $ for FILE in `ls -a` ...
> 
> However, if a file name contains spaces, it is parsed as two strings, ie
> as two file names:
> 
> ----------------------------
> 
> agger@lakshmi:~$ ls | grep Ubu
> Ubuntu One
> agger@lakshmi:~$ for file in `ls | grep Ubu`; do echo   $file; done
> Ubuntu
> One
> 
> 
> ----------------------------
> 
> 
> This breaks a LOT of shell scripts. It's possible to code around this,
> of course, but I don't think the system should use such names by
> default.

ah, but that's not globbing, that is improper escaping. So, IMHO,
those scripts are broken (and yes, a space would tickle the
bug). Scripts should always be prepared for funny characters in
filenames; in this case it would be

    for file in "`ls | grep Ubu`"; do echo "$file"; done

so... ok, if you think what should be fixed are filenames and not the
tools, that's your POV and I respect it, but please don't call it
"globbing". Call it "interpolation" or "substitution" if you need
something word-size.

Attachment: signature.asc
Description: Digital signature


Follow ups

References