- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help (while, pipe and remsh"
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:19 AM
09-10-2002 10:19 AM
I need some help with the following script. I have a file "a" with the following syntax -
hostA fileA1 fileA2
hostB fileB1 fileB2
hostC fileC1 fileC2
(... and so on)
I want to read this file (one line at a time)and check the existence of files in respective hosts. The script, I am using is -
#!/bin/sh
cat a|while read x y z
do
remsh $a "ll $y $z"
done
The problem is that the script is reading just first line of the file "a" and never goes further. If I replace remsh command with echo (say, echo $x, $y, $z), all line of file "a" are read.
What do I need to make the script work? I am puzzled because echo works but remsh stops after reading first line. (And yes, I do have remsh capability as that user on all hosts listed in file "a")
Thanks in advance
...Manjeet
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:26 AM
09-10-2002 10:26 AM
Re: Script help (while, pipe and remsh"
WHAT is $a set too??
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:32 AM
09-10-2002 10:32 AM
Re: Script help (while, pipe and remsh"
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:33 AM
09-10-2002 10:33 AM
Re: Script help (while, pipe and remsh"
It looks like you are reading the contents of file 'a' into variables x, y, and z. Shouldn't your 'remsh' line read:
remsh $x "ll $y $z"
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:38 AM
09-10-2002 10:38 AM
Re: Script help (while, pipe and remsh"
Ray
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:44 AM
09-10-2002 10:44 AM
Re: Script help (while, pipe and remsh"
By default, remsh reads its standard input and sends it to the remote command because remsh has no way to determine whether the remote command requires input. The -n option redirects standard input to remsh from /dev/null. This is useful when running a shell script containing a remsh command, since otherwise remsh may use input not intended for it. The -n option is also useful when running remsh in the background from a job control shell, /usr/bin/csh or /usr/bin/ksh. Otherwise, remsh stops and waits for input from the terminal keyboard for the remote command. /usr/bin/sh automatically redirects its input from /dev/null when jobs are run in the background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 10:46 AM
09-10-2002 10:46 AM
Re: Script help (while, pipe and remsh"
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 11:08 AM
09-10-2002 11:08 AM
Re: Script help (while, pipe and remsh"
#!/bin/sh
cat a|while read x y z
do
remsh $x -n "ll $y $z"
done
live free or die
harry