returned from remote command


 
Thread Tools Search this Thread
Operating Systems HP-UX returned from remote command
# 1  
Old 04-30-2008
returned from remote command

Hi, there,
I want to excute the remote command shell via "remsh", are there any simple or best way to get the result of remote shell from local ? thanks.
# 2  
Old 04-30-2008
Code:
ret_value=`rsh host "command1 ; command2 ; echo $?"`

Regards
# 3  
Old 04-30-2008
chaining works too:
Code:
retval=`rsh hostname "command1 && echo "OK1"  && command2 && echo "OK"`

- tells you which command failed;
plus it stops if command1 fails and doesn't do command2 which can be good sometimes
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sort file returned by FIND command in ascending

Hi there I have to enhance my current file looping to ensure the oldest file being processed first. current command: for FILENAME in `find $MY_DIRECTORY -follow -type f` I manage to get command for order by date modified descending, just can't get the ascending order. Please help for... (3 Replies)
Discussion started by: elsie512
3 Replies

2. UNIX for Dummies Questions & Answers

Assigning the output of a command to a variable, where there may be >1 line returned?

Hello I am using unix CLI commands for the Synergy CM software. The command basically searches for a folder ID and returns the names of the projects the folder sits in. The result is assigned to a variable: FIND_USE=`ccm folder -fu -u -f "%name"-"%version" ${FOLDER_ID}` When the command... (6 Replies)
Discussion started by: Glyn_Mo
6 Replies

3. Shell Programming and Scripting

'who' command -- getting data returned into variables (in bash)

Anyone know how to get the data out of the "who" command? I'm still in lukewarm pursuit of creating an OS X-like welcome message at the start of any Terminal session, sans having to use either bash login or calling up ssh. My trials & errors and surfing around have narrowed it down for me... (1 Reply)
Discussion started by: SilversleevesX
1 Replies

4. Shell Programming and Scripting

number of lines returned from a grep command

hi all, from a shell (ksh) script, i am doing a 'grep'. how do i find out the number of lines returned from that 'grep' command ?? thanks in advance. (4 Replies)
Discussion started by: cesarNZ
4 Replies

5. Shell Programming and Scripting

Retrive the value returned by a command excuted in a remote server using ssh

Hello Everybody, I'm facing a weird problem with the awk command. I try to retrieve in a variable the value returned by a simple ls command. ls /export/home/tmp |tail -1 return a good value (the name of the . But When I try to execute the same command in a remote server using ssh as... (2 Replies)
Discussion started by: Jabarod
2 Replies

6. Shell Programming and Scripting

How to find out command has returned any value?

Hi Pals I am using this command in my script to find out warnings using fgrep where $log is the log file name, $date is the date to be searching and warnings.list contains list of matching words. grep "WARNING" $log|grep "$date"|fgrep -vf warnings.list I want to perform another action... (1 Reply)
Discussion started by: johnl
1 Replies

7. UNIX for Dummies Questions & Answers

Problem with files returned using Find command

When I enter the command below grep appears to be returning a file it shouldn't. find . -name "*.*" -exec grep "testing" {} /dev/null \; :tps3Mailfile ./SSI.ksh: # create TECHOUT dummy for test for testing purposes ./ftprimi1.ksh:# before running job in prod... change FTP to go to rimi... (3 Replies)
Discussion started by: dfb500
3 Replies

8. UNIX for Dummies Questions & Answers

Copying file names returned from a grep command into another directory

When I do the following : grep -l "string" *, I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?. Thanks. (4 Replies)
Discussion started by: Kartheg
4 Replies

9. UNIX for Advanced & Expert Users

w/who command returned zero users

Hi ppl, We are using Sun OS and recently, encountered this strange problem. When issuing the "w" or "who" command, the system produce no listing. See screen shot below. ----------------------- $ w 2:56pm up 2 day(s), 21:10, 0 users, load average: 1.03, 0.75, 0.69 User tty ... (6 Replies)
Discussion started by: sinyem
6 Replies

10. Shell Programming and Scripting

Incorrect Exit Status Returned from FTP command - Help??

I am trying to perform some error handing within a Korn sheel script whilst FTPing a file from one server to another.. The exit status is correctly set to zero, if my script connects to the other server and sends the file.. However, if for whatever reason other than a timeout the script... (3 Replies)
Discussion started by: frustrated1
3 Replies
Login or Register to Ask a Question