- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rval of nslookup
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
08-03-2001 09:58 AM
08-03-2001 09:58 AM
nslookup host
rval=$?
if [[ $rval -eq 0 ]];then
echo 'it works'
else
echo 'no host'
fi
this always returns 'it works' no matter what host yo put in??
I use the rval with grep all the time, and 0 is success, 1 is fail. can this not be done with nslookup?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:08 AM
08-03-2001 10:08 AM
SolutionThere's no rule that you must exit with a zero/non-zero value. Convention dictates that zero (0) is success and (1) is failure. Two (2) is often used to denote a "warning". However, as a writer I could just as easily exit(0), regardless.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:10 AM
08-03-2001 10:10 AM
Re: rval of nslookup
Well I would say the command succeeded although it did not find what you were looking for (the command did work) so why not test on something like "can't find host" ?
My 2 cents
ALl the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:14 AM
08-03-2001 10:14 AM
Re: rval of nslookup
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:19 AM
08-03-2001 10:19 AM
Re: rval of nslookup
nslookup is one of many ways to resolve an address. A better way for your question is the little known command: getip
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:19 AM
08-03-2001 10:19 AM
Re: rval of nslookup
Welcome to UNIX, just because the rules and conventions are there doesn't mean the developer has to follow them. Sometimes you have to do string patterm matching (and this is one of them); sometimes you have to look at the 3rd column of the 10th line of output to
know it a command succeeded.
If you really want to be frustrated try using remsh.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2001 10:33 AM
08-03-2001 10:33 AM
Re: rval of nslookup
thanks, you know someone could really learn alot from you guys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2001 03:40 AM
08-06-2001 03:40 AM
Re: rval of nslookup
I would say, all hp-ux commands which got internal menus ( like lanadmin, ftp, nslookup, rgy_edit, ...) have the same behaviour like what you discribe : Return exit 0 upon completion whether succeeded or not ( that's mean finshes with succes but don't mean the what it was doing is succeeded ! ).
But usual hp-ux commands ( not divisible commands ) behave like what you supposed initially. If a command no not succeed what it is intended to do so the return code will be different from 0.
Magdi