- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script problem
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-19-2003 05:01 AM
09-19-2003 05:01 AM
Script problem
#!/usr/bin/sh
if [ $# -lt 1 ]
then
echo "\nUsage: $0
exit 1
fi
HOST=$1
A=`/usr/bin/grep $HOST /etc/hosts | awk '{print$2}' | wc -l`
if [ A -gt 0 ] then
# Run remote shell to remote host and export display
exec /usr/bin/remsh $HOST -n /usr/bin/X11/dtterm -display $DISPLAY
-ls -title $HOST -n $HOST -sb -sl 500 &
else
echo "Unknown host...please try again"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:06 AM
09-19-2003 05:06 AM
Re: Script problem
if [ A -gt 0 ] then
It should be
if [ $A -gt 0 ]
Those are the really annoying ones!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:07 AM
09-19-2003 05:07 AM
Re: Script problem
No I still get the same answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:08 AM
09-19-2003 05:08 AM
Re: Script problem
Does that host is listed in /etc/hosts?
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:11 AM
09-19-2003 05:11 AM
Re: Script problem
Ok, firstly
That whole line looks a bit overly complicated to me.
How about
grep $HOST /etc/hosts > /dev/null && {
exec /usr/bin/remsh $HOST -n /usr/bin/X11/dtterm -display $DISPLAY -ls -title $HOST -n $HOST -sb -sl 500 &
exit
}
echo "Unknown host.... please try again"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:15 AM
09-19-2003 05:15 AM
Re: Script problem
change
if [ A -gt 0 ] then
to
if [ A -gt 0 ]; then
and try it.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:18 AM
09-19-2003 05:18 AM
Re: Script problem
Thanks for all that answered.
Firstly I was running the script from the wrong area and it was picking up the wrong executable.
Secondly its Friday...doh
This now works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 05:19 AM
09-19-2003 05:19 AM
Re: Script problem
if [ `grep $HOST /etc/hosts | wc -l` -gt 0 ]; then
And grep returns a status, so you don't even need the wc, see MArk's example
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2003 07:02 AM
09-19-2003 07:02 AM
Re: Script problem
please consider:
if the whole stuff is tried in an NIS or DNS environment, depending on /etc/nswitch.conf it
may be totally meaningless, if 'grep' succeeds in
/etc/hosts or not ...
mfG Peter