HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Return command in a shell script
Operating System - HP-UX
1838689
Members
4120
Online
110128
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-21-2003 07:04 AM
01-21-2003 07:04 AM
Return command in a shell script
Hello,
Is there an equivalent command for the return command in HP world. I'm trying to debug compaq scripts to work on HP, but a return command doesn't work (it's normally going back in a loop and do some tests).
Thanks in advance
Regards
J??r??me
Is there an equivalent command for the return command in HP world. I'm trying to debug compaq scripts to work on HP, but a return command doesn't work (it's normally going back in a loop and do some tests).
Thanks in advance
Regards
J??r??me
J@Y
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 07:18 AM
01-21-2003 07:18 AM
Re: Return command in a shell script
I don't understand your question. HP's POSIX and Korn shells have the return command and it works as advertised. Normally it is used to return a function result but if used while not in a function then it is equivalent to an exit.
What may be happening is that you are using a return in a sourced script
e.g.
. myscript.sh
within a parent script. In this case, the sourced script becomes part of the parent process and a return is then an exit.
What may be happening is that you are using a return in a sourced script
e.g.
. myscript.sh
within a parent script. In this case, the sourced script becomes part of the parent process and a return is then an exit.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 07:25 AM
01-21-2003 07:25 AM
Re: Return command in a shell script
Hi Jerome,
If you put a return code after your exit statement at the end of your code, you should be able to get that return code you are looking for.
If you put a return code after your exit statement at the end of your code, you should be able to get that return code you are looking for.
Cooperation is doing with a smile what you have to do anyhow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 07:36 AM
01-21-2003 07:36 AM
Re: Return command in a shell script
If you want to test return code in shell script, you can do:
exit n ==> n is the number
To test:
if [[ $? = n ]]
then
...
fi
This test can be done by other shell script.
exit n ==> n is the number
To test:
if [[ $? = n ]]
then
...
fi
This test can be done by other shell script.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP