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
  • 369,052
  • 73
  • 620
  • 1,021
Troskyvs
  • 6,313
  • 4
  • 38
  • 91

1 Answers1

0

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