I created a bash function to execute my C files, but it's not showing segmentation fault
error when executed.
Bash function:
makex () {
make $1 && "./$1"
}
Output:
cc example.c -o example
Separating make and the command to execute the program results in the same output.
Creating a separate bash script in my bin folder results in the desired output:
cc example.c -o example
/home/user/bin/makex: line 28: 18981 Segmentation fault ./$1
But I would like to keep this inside a function in a file that is in my PATH.
If there is a way to show the output exactly how it's showed when I directly execute it from the shell it would be perfect, because that is what I intended with this function:
$ make example && ./example
cc example.c -o example
[1] 19043 segmentation fault ./example