- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: while -h
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
01-27-2005 01:01 AM
01-27-2005 01:01 AM
I'm just debugging a shell script (that I didn't write) and it contains a line:
while -h $PRG
I can't find any reference to -h in any of my books or in a manual page. 10 points to the first person who tells me what -h means in this context. Further points to anyone who can tell me which manual page I will find it in.
Mark Syder (like the drink but spelt different)
Solved! Go to Solution.
- Tags:
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 01:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 01:07 AM
01-27-2005 01:07 AM
Re: while -h
-h file True, if file exists and is a symbolic link.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 01:11 AM
01-27-2005 01:11 AM
Re: while -h
Looking at the rest of the while loop, I think Tom's answer is the one that applies in this case. The script makes a lot more sense now.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 01:19 AM
01-27-2005 01:19 AM
Re: while -h
the -h is actually part of a test.
see man test for the full spec.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 01:30 AM
01-27-2005 01:30 AM
Re: while -h
Six points for telling me which manual page to look at.
This thread can now be considered closed.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 06:54 PM
01-27-2005 06:54 PM
Re: while -h
You do not need to concider a thread closed anymore. Look on the page and you will see a close thread button ;)
That will stop people like me replying after the fact :P
Gerhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 07:07 PM
01-27-2005 07:07 PM
Re: while -h
Please see http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=793765 - this thread persuaded me that the "close thread" feature is a bad thing that should be avoided (and preferably removed).
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 07:31 PM
01-27-2005 07:31 PM
Re: while -h
-h is used to test when condition is enclosed in (single or double) square brackets.
while [ -h $PRG ]
or
while [[ -h $PRG ]]
For me, an expression as
while -h $PRG
means '-h' is a command.
I've written down a script using this line and the error message is:
-h: not found
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 07:44 PM
01-27-2005 07:44 PM
Re: while -h
Missed that one, I do agree with your thought process :)
Gerhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 08:25 PM
01-27-2005 08:25 PM
Re: while -h
while [ -h $PRG ]
meaning '[' is the command being run. And '[' is linked to the test command.
So it seems you have:
1) a special shell, having a different while command
2) an alias for while (while="while test" or something like that, though I cannot get this to work)
3) an alias for -h (-h="test -h" (this works: alias -- -h="test -h")
Or some variant on these...