Reputation: 1945
How do I make an alias in my .bashrc
such that I can run two commands with arguments?
For example, compile source and run.
gcc-run -lm example.c
would run
gcc -lm example.c
./a.out
The closest I found was this question but it doens't have any arguments.
Upvotes: 2
Views: 628
Reputation: 531165
If you want to pass an argument, you can't use an alias. You need to use a shell function. It sounds like you want something similar to
gcc-run () {
gcc "$@"
./a.out
}
Upvotes: 5