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.
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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.