- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rexec acts as break in ksh while loop?
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
Discussions
Discussions
Discussions
Forums
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
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
тАО03-07-2002 01:18 AM
тАО03-07-2002 01:18 AM
The second says if the node is hostname, execute the third shell script using ksh -c, otherwise execute it on the remote node using rexec.
The loop continues working until it reaches a remote node. It executes the script on the remote node, but then the loop exits.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2002 01:29 AM
тАО03-07-2002 01:29 AM
SolutionPrefer a for loop to a while loop.
first.sh:
#!/sbin/sh
for node in `cat nodelist`
do
second.sh $node
if [ -e /tmp/foundit ]
then
rm -f /tmp/foundit
exit 0
fi
done
second.sh:
#!/sbin/sh
if [ "$1" != "`hostname`" ]
then
rexec $1 third.sh
touch /tmp/foundit
else
ksh -c third.sh
fi
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2002 02:24 AM
тАО03-07-2002 02:24 AM
Re: rexec acts as break in ksh while loop?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2002 02:48 AM
тАО03-07-2002 02:48 AM
Re: rexec acts as break in ksh while loop?
With while loops, any remsh/rexec calls within the loop need to use the -n switch - here's the man entry to explain:
===================
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.
===================
Because "while" uses read, but "for" doesn't, this hopefully explains the difference.
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2002 04:11 AM
тАО03-07-2002 04:11 AM
Re: rexec acts as break in ksh while loop?
That explains another problem I was having. (the -n)