这个命令在命令行上运行良好...
if g++ -std=c++11 main.cpp ; then ./a.out; fi
但是当我尝试将它作为一个函数添加到我的.bashrc中时,它失败了...
function cgo() { if g++ -std=c++11 "$1" ; then ./a.out; fi }
>$ cgo main.cpp
bash: syntax error near unexpected token `main.cpp'
我在这里做错了什么?