我已经搜索并找到了几个答案,但我没有成功地改变我的答案。
操作系统:Mac OS X
我的 .bashrc 内容
# Before other PATHs...
PATH=${PATH}:/usr/local/share/python
alias la='ls -la'
function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec grep -l $2 {} \;}
#export -f find_cpp_filepath_with_string
else
echo "WARNING: Can't find virtualenvwrapper.sh"
fi
麻烦的是下面一行
function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec grep -l $2 {} \;}
在尝试 source ~/.bashrc 之后,结果是:
line 21: syntax error: unexpected end of file
最佳答案
当您说 麻烦的行如下
时,您是对的。你少了一个分号。说:
function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec grep -l $2 {} \; ; }
^ |----- You need to add a semicolon here!
find
命令需要第一个分号来表示 -exec
的结束。在 command group 之后需要第二个.
关于macos - .bashrc 文件意外结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20311907/