This command works fine on the command line ...
if g++ -std=c++11 main.cpp ; then ./a.out; fi
But when I try to add it to my .bashrc as a function, it fails ...
function cgo() { if g++ -std=c++11 "$1" ; then ./a.out; fi }
>$ cgo main.cpp
bash: syntax error near unexpected token `main.cpp'
What am I doing wrong here?
source
share