rsh in Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rsh in Perl
# 1  
Old 07-14-2008
Error rsh in Perl

How can I use the rsh command in perl?
I need to rsh to a machine, change directory and run a C program there.
I have something like this:
$USER="username";
$MY_DIR="\t\home\"
$MY_SCRIPT="./get_statistics.out"
system "sudo rsh", $USER, "cd", $MY_DIR, "; sudo", $MYSCRIPT;

which obviously does not work...Smilie
# 2  
Old 07-14-2008
Here are a couple other options:

$cmd = "/sbin/command whatever";
system $cmd;

OR


@args = ("command", "arg1", "arg2");
system(@args) == 0
or die "system @args failed: $?"

You can check all the failure possibilities by inspecting $?

OR


$cmd = `\sbin\command whatever`;

$cmd will return status code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

RSH

Hi All, Whenever we are giving rsh localhost date , it give an error "Permission Denied". RHEL 6 is the version, and we're logging in as "root". in .rhosts file I have mentioned all the details, and enabled rsh,rsync,rexec,rlogin in /etc/xinetd.d/ file Please suggest. Reg, Muzaffar (7 Replies)
Discussion started by: muzaffar.k
7 Replies

2. Shell Programming and Scripting

Perl and rsh

Hi guys In perl how can i rsh into the machine ($a) as the user who is currently login into that machine then run this commnad x11vnc -create keeping that alive but back on the origrianl ($b) machine run vncviewer $a i want to give it the machine to rsh/vncv into on the... (0 Replies)
Discussion started by: ab52
0 Replies

3. Shell Programming and Scripting

Perl script with rsh gets stty invalid message

I have a Perl script, that does a system call with rsh to a remote machine. #!/usr/bin/env perl system ("rsh remote-machine echo 99"); And I get the following: stty: standard input: Invalid argument 99 I've tried replacing the system call with below, but I still get the same stty... (1 Reply)
Discussion started by: slchin
1 Replies

4. Red Hat

Rsh

Hi, I issue : rsh ****.16.0.151 -l root ls -l /tmp and I receive : connect to address ***.16.0.151: Connection refused Trying krb4 rsh... In hosts file of remote (***.16.0.151) I have : ***.16.0.202 root Can you help me ? Thank you. (0 Replies)
Discussion started by: big123456
0 Replies

5. Solaris

rsh

How to enable rsh in solaris (7 Replies)
Discussion started by: durgaprasadr13
7 Replies

6. AIX

Rsh

How to configure rsh for different users in aix? (4 Replies)
Discussion started by: vjm
4 Replies

7. UNIX for Dummies Questions & Answers

help on rsh

hi friends, i've access to three machines mc1,mc2,mc3,on which i can log in as root. and in order to run a simple command on a remote machine(say remote) on which i cant log in,i use a command as; # rsh remote ls the above runs properly but if i do an ls on following it doesnt work # rsh mc2... (1 Reply)
Discussion started by: mxms755
1 Replies

8. UNIX for Advanced & Expert Users

where is rsh

Hi, when a user use rsh command (or any other) , where is the executable used by him ? Many thanks in advance. (1 Reply)
Discussion started by: big123456
1 Replies

9. UNIX for Dummies Questions & Answers

about rsh

I have two host ( hostA and hostB ) , now hostA can use " rsh -l userB hostB " to rsh to hostB without input the password , it work fine, but if I modify it to " rsh -l userB hostB -n "ls" " , it will pop the message "Permission denied." , could suggest what is wrong ? thx (1 Reply)
Discussion started by: ust
1 Replies

10. Shell Programming and Scripting

help with rsh

I am trying to run a Perl script using rsh. I need to be able to capture the return code value, so the calling script can handle failures properly. I cannot modify the Perl script I need to run because we use it for all of our servers. Does anyone have a suggestion? (1 Reply)
Discussion started by: kscase
1 Replies
Login or Register to Ask a Question