Terminal.app中的新选项卡无法在同一目录中打开/ bash失败(Mountain Lion)

the*_*yes 2 bash terminal osx-mountain-lion

基本问题:当我在终端中打开一个新选项卡时,bash失败并出现以下错误输出:

bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `exec -la (null) (null) -1'

[Process completed]
Run Code Online (Sandbox Code Playgroud)

在首选项中,我将新选项卡设置为使用相同的设置/目录打开.

我一直在搞乱学习自定义bash提示区域,实际上是为了解决这个问题,但无济于事.在我意识到应该由用户执行此操作之前,我弄乱了/ etc/bashrc,我已将该文件重置为如下所示:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
  return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
   update_terminal_cwd() {
       # Identify the directory using a "file:" scheme URL,
       # including the host name to disambiguate local vs.
       # remote connections. Percent-escape spaces.
       local SEARCH=' '
       local REPLACE='%20'
       local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
       printf '\e]7;%s\a' "$PWD_URL"
   }
   PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
Run Code Online (Sandbox Code Playgroud)

最后,我的〜/ .bash_profile看起来像这样:

source /etc/bashrc

export PATH=~/Code:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin.

export CLASSPATH=~/Programs/:~/Programs/bailey.jar:~/Programs/labs/:.
export PYTHONPATH=~/dm/:~/Code/Git/.:.
Run Code Online (Sandbox Code Playgroud)

如果有人能给我任何建议,那将是美好的.

Joh*_*ohn 5

我也有这个问题,并发现我不小心改变了终端首选项的"启动"选项卡中的设置.设置为"Shells open with:Command(完整路径):."

我把它改回"打开shell:默认登录shell",这解决了问题.