hi i'am not really fluent in bash shell script, i'am doing some compilation using gcc that executed by bash script, how do I know (check) if the compilation was successful or not? any example?
Bash – GCC compile result from Bash script
bashg++gccscripting
Related Topic
- Best Way to Check if a Volume is Mounted in a Bash Script – Linux Bash
- Difference Between Double and Single Square Brackets in Bash – Scripting Shell POSIX
- Linux – How to fully log all bash scripts actions
- Linux – bash script alert on error
- Bash: Execute piped lines from stdin
- Bash – Run an interactive bash subshell with initial commands without returning to the (“super”) shell immediately
- Bash – Check if array is empty in Bash
Best Answer
Since you are doing this in a script, you could alternatively check the exit code of the commands as you run with the
$?
variable.You could do something like:
Personally I tend to be more verbose and use longer forms in scripts because you never know who will be maintaining it in the future.
If it was a one off command line run i would use the method that Dennis and mibus have already mentioned