Your condition should be:
if [ $? -ne 0 ]
GCC will return zero on success, or something else on failure. That line says “if the last command returned something other than zero.”
More Related Contents:
- Building R Packages using Alternate GCC
- What is the cleanest way to ssh and run multiple commands in Bash?
- How can I do a recursive find/replace of a string with awk or sed?
- What is the purpose of “&&” in a shell command?
- How to avoid heredoc expanding variables? [duplicate]
- Bash script – store stderr in a variable [duplicate]
- Bash command to sum a column of numbers [duplicate]
- Why can’t I use job control in a bash script?
- echo that outputs to stderr
- Bash if statement with multiple conditions throws an error
- How to show and update echo on same line
- Explanation of colon operator in “: ${foo=value}”
- Bash indirect variable referencing
- Simulate user input in bash script [closed]
- How do I pause my shell script for a second before continuing?
- How do you echo a 4-digit Unicode character in Bash?
- Check if image:tag combination already exists on docker hub
- bash getopts with multiple and mandatory options
- Why is #!/usr/bin/env bash superior to #!/bin/bash?
- Bash shell Decimal to Binary base 2 conversion
- Checking host availability by using ping in bash scripts
- using jq to assign multiple output variables
- -bash: !”: event not found [closed]
- How to substitute quoted, multi-word strings as arguments?
- Why do my setuid root bash shell scripts not work?
- Reading null delimited strings through a Bash loop
- Using grep to search for hex strings in a file
- How can I execute a bash function using sudo?
- Bash: warning: here-document at line delimited by end-of-file (wanted `EOF’) [duplicate]
- How to parse a string with multiple characters to split on-Bash Scripting