The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to mount a file system of a remote machine to local file system cy163 UNIX for Dummies Questions & Answers 2 01-31-2008 09:04 AM
set variables on remote system funksen UNIX for Dummies Questions & Answers 2 11-23-2007 06:44 AM
How to remote backup with AIX system guest AIX 1 04-19-2007 05:45 AM
Boot from a remote system hemant29 UNIX for Dummies Questions & Answers 1 01-30-2006 09:29 AM
Running ssh on a remote system? cstovall Shell Programming and Scripting 1 09-12-2005 11:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-10-2003
gio123bg gio123bg is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 15
Rsh: test $? on remote system.

Hi,
a little help.

I need to test the return code of a list file command on a remote system (Unix) using the rsh command. More exactly, to test is a directory exists, I try the following command:

rsh $remoteHost "ls -la " $DirRemote

Now, if the $DirRemote is not correct and I test the $? I found 0.

If I try to check the $? on remote system for this remote command, in this way

rsh $remoteHost "ls -la " $DirRemote " ; echo $?"

to capture a value different, the value is always 0, preceded by an error message.

Any idea?
Thanks in advance.

Giovanni
  #2 (permalink)  
Old 12-10-2003
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
I really don't know anything about the rsh command, but you could try PxT's idea.. no idea if it works or not since the OP never responded.

Here's another post, but I'm not sure how much help it'll be either.
  #3 (permalink)  
Old 12-10-2003
gio123bg gio123bg is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 15
Thanks a lot oombera!
My problem was the single quotes not used in my code!

Now I solved the problem in this way:

rsh $remoteHost 'ls -la $DirRemote >/dev/null 2>$1 ; echo $?'

and the return code is correctly set to 2.
  #4 (permalink)  
Old 12-11-2003
jayakhanna jayakhanna is offline
Registered User
  
 

Join Date: Dec 2003
Location: India
Posts: 50
Originally posted by gio123bg

rsh $remoteHost 'ls -la $DirRemote >/dev/null 2>$1 ; echo $?'

----------------------------------------------------------------------------------

Won' t you think using single quotes for the whole thing will be good

like

'rsh $remoteHost 'ls -la $DirRemote >/dev/null 2>$1 ; echo $?'

I think this will tell you if the rsh fails and your ls passes.

Cheers
JK
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0