- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting help
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
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
тАО04-09-2001 03:05 AM
тАО04-09-2001 03:05 AM
Secondly, I need to test in one of my scripts whether one of the parameters entered ends with a ".h". Any ideas on how I go about this please?
Thanks
Carlo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2001 03:57 AM
тАО04-09-2001 03:57 AM
Solutionman sh
man sh-posix
man ksh
man csh
Otherwise get a text book for your preferred shell.
I always found the O'Reilly books quite worthwhile.
Here is a suggestion for testing for header filename suffixes passed as parameters to a script (though this is not particularly elegant and could be done better)
#!/bin/sh
for param in $*; do
if [ "${param#*.}" = "h" ]; then
# do something
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2001 04:01 AM
тАО04-09-2001 04:01 AM
Re: Scripting help
echo
if [ $? != 0 ]; then
or
if [ $? = 0 ]; then
example:
echo $2 |grep .h > /dev/null
good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2001 04:10 AM
тАО04-09-2001 04:10 AM
Re: Scripting help
See these two threads for a sampling of suggestions for good references/guides to shell scripting:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xb75e7e990647d4118fee0090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xbb5e7e990647d4118fee0090279cd0f9,00.html
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2001 05:00 AM
тАО04-09-2001 05:00 AM
Re: Scripting help
Thanks so far, this seems to work however, I presume $? is the return code from the last command?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2001 05:16 AM
тАО04-09-2001 05:16 AM
Re: Scripting help
If the result is 0, then the argument has .h, if it's not then it hasn't.