osx bash 命令给出分段错误:11

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41084393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:31:11  来源:igfitidea点击:

osx bash command gives Segmentation fault: 11

bashmacos

提问by Gao Bill

when i open a new terminal window in OS X and just type bash, i got a segmentation fault:11 all the time. The problem seems to be specific to my machine as i have tried it on another machine and it worked fine. bash gives out segfault 11

当我在 OS X 中打开一个新的终端窗口并输入 bash 时,我总是遇到分段错误:11。这个问题似乎是我的机器特有的,因为我已经在另一台机器上尝试过它并且工作正常。 bash 给出段错误 11

回答by chepner

You had infinite recursion. When bashstarted, it executed .bashrc, which sources .bashrc, which sources .bashrc, etc. Eventually, you run out of memory somewhere, because bashhas to remember where in the previous iteration of .bashrcit is so it can continue after the next one returns, which leads to the segmentation fault.

你有无限递归。当bash启动时,它执行.bashrc,其源.bashrc,源是.bashrc等最后,你记忆的地方跑出来,因为bash必须记住其中的前一次迭代.bashrc就这样它可以在下一个返回后继续,这导致了分割过错。