- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: loop control inside function
Operating System - HP-UX
1753856
Members
7307
Online
108809
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
Discussions
Discussions
Forums
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
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
тАО03-25-2009 03:57 AM
тАО03-25-2009 03:57 AM
loop control inside function
Hi All,
I need some clarification (and maybe more information) about the attached example script, which is working fine (as it expected) under bash, but not under ksh88/93. In ksh the "break" and "continue" does not do their job if they are passed to the loop from a function. For the "exit" it is OK.
Please advice.
I need some clarification (and maybe more information) about the attached example script, which is working fine (as it expected) under bash, but not under ksh88/93. In ksh the "break" and "continue" does not do their job if they are passed to the loop from a function. For the "exit" it is OK.
Please advice.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2009 04:01 AM
тАО03-25-2009 04:01 AM
Re: loop control inside function
Shalom,
Reading:
http://my.safaribooksonline.com/0596003307/upt3-CHP-31-SECT-6
loop control works the same way outside as inside a function.
SEP
Reading:
http://my.safaribooksonline.com/0596003307/upt3-CHP-31-SECT-6
loop control works the same way outside as inside a function.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2009 04:16 AM
тАО03-25-2009 04:16 AM
Re: loop control inside function
Hi:
A 'break' or 'continue' exits from a 'for', 'select', 'until', or 'while' loop, not from a function in the POSIX (or 'ksh') shells.
An 'exit' causes termination of the whole script. A 'return' exits from a _function_.
Yes, the behavior of the Bash shell is different.
If you are running on HP-UX, using a Bash shell is fine _AS_LONG_AS_ you _NEVER_ make it the default shell for root.
The POSIX shell in '/sbin/sh' doesn't use shared libraries which aren't available in single user mode. Hence it MUST be the only shell used during startup. If you change root's default shell to anything else, you will render your system un-startable!
Regards!
...JRF...
A 'break' or 'continue' exits from a 'for', 'select', 'until', or 'while' loop, not from a function in the POSIX (or 'ksh') shells.
An 'exit' causes termination of the whole script. A 'return' exits from a _function_.
Yes, the behavior of the Bash shell is different.
If you are running on HP-UX, using a Bash shell is fine _AS_LONG_AS_ you _NEVER_ make it the default shell for root.
The POSIX shell in '/sbin/sh' doesn't use shared libraries which aren't available in single user mode. Hence it MUST be the only shell used during startup. If you change root's default shell to anything else, you will render your system un-startable!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2009 05:31 AM
тАО03-25-2009 05:31 AM
Re: loop control inside function
Thank you both,
for fast and accurate response.
James I've never wanted to change the default root's shell, even I didn't want to install the bash, because of that I found the way to simulate the behavior of bash under ksh in that current situation; it's just using one simple variable.
And thank you again you two.
for fast and accurate response.
James I've never wanted to change the default root's shell, even I didn't want to install the bash, because of that I found the way to simulate the behavior of bash under ksh in that current situation; it's just using one simple variable.
And thank you again you two.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP