Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Prelude scripts in app-bundles



I've updated my how-to article on raising the open-files limit for Java apps:
<http://www.amug.org/~glguerin/howto/More-open-files.html>

The new version should work even on machines without the full BSD
sub-system installed, that is, when 'dirname' is not present.

The trick is to replace this line in the prelude-script:
here=`dirname "$0"`

with this paragon of lucidity:
here="${0%/*}"

The expression being assigned to "here" isn't random line noise. It means:
Strip the shortest suffixed pattern matching "/*" from the "$0" parameter.

Since $0 is the full pathname of the shell-script, and the shortest suffix
matching the shell-pattern "/*" is simply the leaf-name of the shell-script
itself, the result is the same as executing `dirname "$0"` in this
particular situation.

For reference, see the section of 'man sh' below "substring processing".
For experimenters, 'dirname' is still more powerful than mere substring
conjuring with shell expressions.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.