bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ulimit call lists invalid options


From: Robert Elz
Subject: Re: ulimit call lists invalid options
Date: Tue, 30 Jul 2019 14:27:23 +0700

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]