Aipi Aipi - 14 days ago 6
Bash Question

How can I create an alias for c compiler with Shell Script?

I'd like to know if is possible create an alias with Shell Script which turn easy my C compilation.

I tried to add it into my

.bashrc
file, however it didn't work how I wish, returning a bad message which said that does not existed any command like that.

alias xpto='gcc prototipo.c -o prototipo.exe $(pkg-config –cflags –libs allegro-5) -lallegro -lallegro_main -lallegro_image -lallegro_ttf -lallegro_font -lallegro_primitives -lallegro_audio -lallegro_acodec -std=c99'

Answer

The error message may be about the command itself. The below commands worked for me but gave an error about the missing file.

machine1:/u/user1>cat .bashrc
alias xpto='gcc prototipo.c -o prototipo.exe $(pkg-config –cflags –libs allegro-5) -lallegro -lallegro_main -lallegro_image -lallegro_ttf -lallegro_font -lallegro_primitives -lallegro_audio -lallegro_acodec -std=c99'
machine1:/u/user1>bash
machine1:/u/user1>xpto
gcc: prototipo.c: No such file or directory
machine1:/u/user1>