Am Donnerstag, 25. Januar 2007 18:01 schrieb John H. Robinson, IV: > Dexter Filmore wrote: > > Well, set DUM to "echo" so it won't execute the command but instead show > > you what the resulting command would look like, then you'll see what I > > mean when running it on a filename with spaces. > > The problem is that you can't see what hte exact arguments are, or even > if the shell recognises the argument as one word or two. Try using > something that will indicate if the file exists or not: > > > [EMAIL PROTECTED]:~]% cat try.sh > #!/bin/sh > ls -b $1 > ls -b "$1" > [EMAIL PROTECTED]:~]% touch hello,\ world > [EMAIL PROTECTED]:~]% ./try.sh hello,\ world > ls: hello,: No such file or directory > ls: world: No such file or directory > hello,\ world > [EMAIL PROTECTED]:~]% ./try.sh "hello, world" > ls: hello,: No such file or directory > ls: world: No such file or directory > hello,\ world > > > As you an see, putting the variable in soft quotes prevents the shell > > >from splitting the word on spaces. > > -john
Well, shouldn't \ do th job as well? Thing is, even if I pass the filename foo\ bar echo tells me the name is foo bar -- -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS d--(+)@ s-:+ a- C++++ UL++ P+>++ L+++>++++ E-- W++ N o? K- w--(---) !O M+ V- PS+ PE Y++ PGP t++(---)@ 5 X+(++) R+(++) tv--(+)@ b++(+++) DI+++ D- G++ e* h>++ r* y? ------END GEEK CODE BLOCK------ http://www.stop1984.com http://www.againsttcpa.com -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
