0

I'm under linux and always run my test program like this:

g++ MyFileName.cpp -std=c++11 && ./a.out

I don't with to type so much, I wish to write a bash alias in my .bashrc, named c++run, so that I can:

c++run MyFileName.cpp

It compiles and if success, run ./a.out

How to write such an alias? If not possible, write a bash function?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Troskyvs
  • 7,537
  • 7
  • 47
  • 115

1 Answers1

0

Use function instead of alias, or a script. Also tinycc could do what you want, AFAIK.