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

Re: OT: shell scripts and spaces in file/folder names



hi ya

On Thu, 17 Apr 2003, Karsten M. Self wrote:

> > for i in ` ls * `
> > do
> >   ls -la ' $i '
> > done
> > 

yup...  thanx for the correction ..   space for $i was
for ease of use to see the silly '  but shoulda been "
and yeah, different file name with extra leading chars too

and one should not use sh either for this stuff...

touch /tmp/'this silly file'
touch /tmp/'just; playing here'

and dont forget that windoze users like to create file names like
	joe's presentation
	mary "birthday present"
	... makes for a mess ...

use perl instead of bash for playing with files ??

if one can impose some rules,
web and cgi form stuff should be just [a-z][0-9]
and disallow all other characters 

c ya
alvin

 
> Nope.  
> 
>   - Environment variables don't resolve in single quotes.  "$i" will
>     work.
> 
>   - You're now referring to the file " foo bar ", not "foo bar".
>     Quoting includes whitespace, including whitespace around the quoted
>     string.  "$i" will give you "foo bar".
> 
> Note that you have to re-quote if you're re-evaluating the command.
> Which is among the reasons spaces are so nasty.  Particularly, say, in
> URLs (quoting errors are a large class of Web errors and security
> holes).
> 
> Peace.
> 
> -- 
> Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
>  What Part of "Gestalt" don't you understand?
>    We freed Dmitry!        Boycott Adobe!         Repeal the DMCA!
>      http://www.freesklyarov.org
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 



Reply to: