Computing.Net > Forums > Linux > ksh script -nubie-

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

ksh script -nubie-

Reply to Message Icon

Name: hypersonic
Date: March 15, 2005 at 02:44:23 Pacific
OS: linux
CPU/Ram: p4
Comment:

Hi there im trying to create a script that will log on to different computers then go to a set directory and then delete some files. I've come up with:

#!/bin/ksh
host="host1 host2 ...."

for h in $host
do
rlogin $h &&
cd /tmp/ &&
rm -f file*

done

It logs into the first host succesfully then stops, when i type 'exit' it then throws up an error then logs into the next host.

How can i pass the 2 other commands down to the rlogin prompt?

thanks in advance

Sam Zakrzewski




Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: March 15, 2005 at 04:35:24 Pacific
Reply:

ksh does not lend it itself to interactive scripting or remote commands. Check into "expect". You will see many examples in this forum. "autoexpect" is a handy macro recording utility.


0

Response Number 2
Name: 3Dave
Date: March 15, 2005 at 08:01:34 Pacific
Reply:

Can you not pass all the commands on one
line? I don't use rlogin but you can with
ssh, eg:
ssh $h 'cd /tmp/ && rm -f file*'


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: ksh script -nubie-

Looping through records cutting www.computing.net/answers/linux/looping-through-records-cutting/26846.html

help with shell script :) www.computing.net/answers/linux/help-with-shell-script-/25502.html

rename script www.computing.net/answers/linux/rename-script/20950.html