I'd like to make a shell script that can compile and run (if it compiles) a C program I created. However, if it doesn't compile I don't want it to run the executable. So far I've created this as my solution;
gcc -o assignment1 assignment1.c if [[ ?$ -eq 0 ]]; then ./assignment1; fi exit 0;
however, it keeps saying line 2 syntax error: unexpected end of file. I'm new to bash can someone explain why this isn't working
fixed syntax errors and closed if statement. Thanks to commenters.