在 macOS 10.7 上,使用 bash
第一次调用 ulimit -n 成功,第二次失败。
a:$ ulimit -n
2560
a:$ ulimit -n 5000
a:$ ulimit -n
5000
a:$ ulimit -n 6000
bash: ulimit: open files: cannot modify limit: Operation not permitted
但是,如果我在一个新的 shell(或另一个 shell)中尝试 ulimit -n 6000,它会成功:
a:$ ulimit -n
2560
a:$ ulimit -n 6000
a:$ ulimit -n
6000
这是为什么?