The ulimit usage lists all the limits that bash supports. Of those, the ones that actually work are the ones that your system also supports.
On my system (like yours) ulimit -P and ulimit -k fail, as while the system has pseudo tty's and kqueues, there are no per process limits on how many can be allocated. On the other hand: ulimit -T 1024 ulimit -b unlimited Further, when I rewrite your script into more rational shell code (it is still not portable, and cannot be, as the format of error messages is almost never defined ... different shells produce different kinds of error messages) [modified script below] I get: jinx$ bash /tmp/S ops=bcdefiklmnpqrstuvxPT /tmp/S: line 14: ulimit: -e: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -i: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -k: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -q: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -r: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -x: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] /tmp/S: line 14: ulimit: -P: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] so there are a whole lot more options (limits) supported on your system than mine. Whether bash ought limit its usage output option list to those options supported on the system it is running on, or whether it is better to list everything it knows about (either my, or your, system might have more limits bash knows nothing about) is a judgement call - neither answer will be right for everyone. kre The modified script (using shell idioms, rather that whatever language you were trying to emulate): ops=$(ulimit -h 2>&1) ops=${ops#*\[-SHa} ops=${ops%%]*} printf ops=%s\\n "$ops" while [ -n "$ops" ] do rest=${ops#?} op=${ops%${rest}} ops=$rest ulimit "-$op" >/dev/null done 2>&1