1. Make sure you have an RSH.EXE in your path. Better, use a full pathname.
2. There's a chance you're bitten by shell quoting. Try using the LIST variant of system:
system ($RSH, qw/hostname -l username -n/, "touch test") == 0 or die "system: $?";
3. Check the return value of system!
One way to test it: can you execute the rsh hostname -l username -n "touch test" command from a dos-prompt successfully? If not, the Perl won't be able to either.
- - arden.
perl -e 'system("dir")' #failed
perl -e 'system(\"dir\")' #failed
perl -e system("dir") #worked
perl -e system(\"dir\") #worked
If you posting is exactly what you type, could this be the be the answer?
Oh yeah, of course that's what I was trying to remember. Quoting is different on DOS boxes. Try this instead:
perl -e "system(\"rsh hostname -l username -n \"touch test\"\")"
From memory (sorry I don't have a Windows box to test on), single quotes don't work very well in the MSDOS prompt. So you need to use double quotes instead. And then you need to escape the double quotes inside the double quotes, or else use single quotes which Perl can handle:
perl -e "system('rsh hostname -l username -n \'touch test\'')"
:: rsh.bat echo %1 >> C:\look.txt echo %2 >> C:\look.txt ...Then try the perl script against the batch file instead of the rsh exe. This should at least confirm that the program is getting the parameters. Aside from that, as others have said, I would try using rsh from the same working directory from the command line and test it there as well.
perlmonks.org content © perlmonks.org and Anonymous Monk, arden, beable, gaal, Scarborough, Unholy One
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03