Operating System - HP-UX
1847056 Members
5648 Online
110261 Solutions
New Discussion

Re: using /usr/bin/ulimit

 
Chris De Angelis
Frequent Advisor

using /usr/bin/ulimit

I have to admit I don't know shell scripting very well, but I'm trying to understand the usefulness of the script /usr/bin/ulimit. These are the contents of this script on my HP-UX 11.00 system:
--------
#!/usr/bin/sh
# @(#) $Revision: 76.1 $

# This is the execable version of ulimit implemented using the
# posix shell built-in ulimit command.

ulimit $@
exit $?
--------

It looks to me like this script executes the shell /usr/bin/sh, calls the ulimit command of that shell with any parameters passed in, and then exits with the status of that command. If that's the case, what would you use this script for, as once you exit the shell created by this script, any setting performed by the sh-posix 'ulimit' command would be lost.

I'm probably missing something here... please clue me in. By the way, I'm in a situation where I have a korn shell script and I want to limit the core dump size within this script. This is not possible with the ksh 'ulimit' command on HP-UX and I'm wondering if there's a way for me to do this without converting my ksh script to a /usr/bin/sh or csh script as ksh on Solaris supports 'ulimit -c' and this script needs to run on Solaris also.
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor

Re: using /usr/bin/ulimit

Hi Chris:

The script is a wrapper to call 'ulimit' as noted. Whatever arguments you pass to it are passed to 'ulimit'.

Why not write your script as a Posix one (/usr/bin/sh) since for HP-UX, this is a superset of the Korn (/usr/bin/ksh)? Then, on your Solaris system, you could (merely?) change the shell interpreter declaration if/as necessary.

Regards!

...JRF...
Chris De Angelis
Frequent Advisor

Re: using /usr/bin/ulimit

Hi James,

Thanks for your reply. I was hoping to find a way to keep the script identical on both HP-UX and Solaris (to keep the installation procedure of our system as simple as possible), but I guess I'll just go with your suggestion of just changing the first line of the script for the appropriate interpreter, which is a minor change the installation routine can handle.

Thanks!
- Chris