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-
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?
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*'
Summary: The first one won't work for various reasons, the main one being that "-f file" means read some awk statements to be executed from "file" - but "rent_payments" is of course the data file in this case....
Summary: Hello guys, I need help with writing a ksh, csh or bash script which will call another script and input arguments for the called upon script. The script wich I'm excuting is asking for input informat...
Summary: Hello, I have a bunch of files named in the manner of 210_slw02_f8.jpg but with different numbers after the 'f'. I want to replace the slw02 in these files with stbdLW02. I have written the followin...