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


Groups > gnu.bash.bug > #15276

Re: ulimit call lists invalid options

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: ulimit call lists invalid options
Date Tue, 30 Jul 2019 14:27:23 +0700
Lines 58
Approved bug-bash@gnu.org
Message-ID <mailman.235.1564471707.1985.bug-bash@gnu.org> (permalink)
References <23361.1564463374@jinx.noi.kre.to> <5D3FB223.5000601@tlinx.org> <14160.1564471643@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1564471707 21988 209.51.188.17 (30 Jul 2019 07:28:27 GMT)
X-Complaints-To action@cs.stanford.edu
To L A Walsh <bash@tlinx.org>, bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
In-Reply-To <23361.1564463374@jinx.noi.kre.to>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From 2001:3c8:9009:181::2
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <14160.1564471643@jinx.noi.kre.to>
X-Mailman-Original-References <23361.1564463374@jinx.noi.kre.to> <5D3FB223.5000601@tlinx.org>
Xref csiph.com gnu.bash.bug:15276

Show key headers only | View raw


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


Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web