Dexter Filmore wrote:
> 
> 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

echo is a bad tool to use to determine where the shell is breaking the
words.

compare:

a="moo cow"
echo \""$a"\"
echo \"$a\"

They both provide the same results, but one is split and the other is
not.

This is why I offered you ls -b. You can also use test -f.

sh-3.1$ touch "moo cow"
sh-3.1$ a=moo\ cow
sh-3.1$ test -f $a
sh: test: moo: binary operator expected
sh-3.1$ test -f "$a"

$a got split, and "$a" remained as a single word. You can also play with
set.

sh-3.1$ a="moo cow"; set - $a; echo $#; set - "$a" ; echo $#
2
1


Stop trying to count the number of arguments with echo: it does not
work.

-john


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to