On Sun, Jan 01, 2006 at 05:58:21AM -0600, Peter Samuelson wrote: > So you want rsh/ssh to do the job of word splitting? The question is
No! The easiest way to do word spliting is not to join the words again after the shell has already split them. No, I am not sure if the protocol support this. I think it should. So, for example: myssh remotehost echo a 'b c' * executes myssh with: ARGV[0] = "myssh" ARGV[1] = "remotehost" ARGV[2] = "echo" ARGV[3] = "a" ARGV[4] = "b c" ARGV[5] = "file1.txt" (obviously I am assuming one file exists in the current directory on the local machine) Which will pass the parameters, still split, to the remote end end run: exec*("echo","a","b c","file1.txt",NULL); (note: I don't have the man page available to double check the various exec variants) > how elaborate its shell-emulation parser should be. Handle \ and " and > ' quoting? Expand environment variables? Expand globs? Execute $() > nested commands? Handle | or || or && or >> or ! or <& or ; or & or ~? > Implement builtins such as chdir and while? If you really want this sort of expansion at the remote end (most of the time I don't), that is easy: myssh remotehost sh -c 'echo a "b c" *' which will become three parameters: sh -c echo a "b c" * This also makes it more obvious (IMHO) why you need two levels of quoting. WHat I propose is much the same as recommended elsewhere, e.g. I have seen the recommendation you shouldn't use: system('echo a "b c"'); In perl, as this requires invoking the shell - if instead you pass the parameter as an array, the shell isn't required, no splitting of the parameters is required, and this makes the script more secure. Unfortunately, it seems the same methods have yet to come to rsh/ssh, etc. Hmmm. I think sudo supports it though: [EMAIL PROTECTED]:~$ sudo 'id; echo hi' sudo: id; echo hi: command not found [EMAIL PROTECTED]:~$ sudo sh -c 'id; echo hi' uid=0(root) gid=0(root) groups=0(root) hi -- Brian May <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]