Jeff Weisberg on Tue, 3 Sep 2002 16:10:08 +0200 |
| > Now, if I do the same through rsh, I get nothing: | > | > rsh somemachine echo '$var' | | That's because rsh is stripping the quotes when it passes them | across (arguably a bug, the quotes are stripped by your local shell, not rsh. no bug. | Try rsh host echo \'$var\' no. you are then escaping the single quotes, and the local shell[1] will try interpolating $var. you need to protect against both the local and remote shell, something like: rsh host echo \'\$foo\' rsh host echo \\\$foo rsh host echo \''$foo'\' ... | Note, btw, that in my example, *some* shells would let you do rsh | host '( cd todir && tar xpf - )', but I don't trust it (and you | really don't want the shell grabbing the &&, and then the tar x "don't trust it"? what, you think it's conspiring against you, whispering behind your back? very few shells have the ability to dynamically alter their quoting rules. just learn what your shell does, and when in doubt, test your assumptions with an 'echo'. --jeff [1] I'm using csh, other shells may have slightly different quoting rules. _________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce General Discussion -- http://lists.netisland.net/mailman/listinfo/plug
|
|