简体   繁体   中英

How to login into a remote machine and execute commands on it using csh script?

I am trying to execute this script. Whenever i try to rsh/rlogin to the machine, it stops the the script from executing and the commands that follow stop executing, please help.

#!/bin/csh -xvf

#####BUILDING####
rlogin buildsub 
pushd $currdir/$currdate/ABC/src;
bsub -I make 64bit=yes dev=opt

Your three commands are each executed separately on your local machine, one after another. Your script doesn't know that the pushd and the bsub are supposed to be used as input to the rlogin. To get round this, use a here doc:

rlogin buildsub  << END_BLOCK
pushd $currdir/$currdate/ABC/src;
bsub -I make 64bit=yes dev=opt
END_BLOCK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM