Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15276 > unrolled thread

Re: ulimit call lists invalid options

Started byRobert Elz <kre@munnari.OZ.AU>
First post2019-07-30 14:27 +0700
Last post2019-07-30 14:27 +0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: ulimit call lists invalid options Robert Elz <kre@munnari.OZ.AU> - 2019-07-30 14:27 +0700

#15276 — Re: ulimit call lists invalid options

FromRobert Elz <kre@munnari.OZ.AU>
Date2019-07-30 14:27 +0700
SubjectRe: ulimit call lists invalid options
Message-ID<mailman.235.1564471707.1985.bug-bash@gnu.org>
ps: if you want to find out which ulimit options
are supported on your system, use (parse) the output
of ulimit -a

Modified script that does that appended .. still
bash specific, as the output format of ulimit -a is
also not specified ... in fact, giving any options to
ulimit at all, aside from -f, is entering into the
great unknown.   Nothing like this can work with dash,
as it does not include the valid options in its error
message when an invalid option is given, and does not
include the option letters in its uname -a output either.

On my system the output is:

	jinx$ bash /tmp/S
	ops=Tbcdflmnpstuv

It happens that the ksh93 outtput format is similar
enough (I had to make one minor change to my original
script to make it work with both) that it works there
too.

	jinx$ ksh93 /tmp/S
	ops=MctdfxlqenupmrbiswTv

note: no usage messages - yet the loop that uses each
option in $ops remains in the script.

kre

(These scripts could do with more error checking, or
data validation, but for now, never mind...)


ops=$(
	ulimit -a | while read -r one
	do
		one=${one%\)*}
		x=${one%?}
		printf %s "${one#${x}}"
	done
)

printf ops=%s\\n "$ops"

while [ -n "$ops" ]
do
	rest=${ops#?}
	op=${ops%${rest}}
	ops=$rest

	ulimit "-$op" >/dev/null

done 2>&1


[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web