You can choose:
if [[ $? -ne 0 ]]; then # -ne: not equal
if ! [[ $? -eq 0 ]]; then # -eq: equal
if [[ ! $? -eq 0 ]]; then
!
inverts the return of the following expression, respectively.
More Related Contents:
- create a file with prefix =file1 followed by the random number
- Why to code a script which will check if some package is installed in linux and if not then install it?
- Read values into a shell variable from a pipe
- Fastest way to find lines of a file from another larger file in Bash
- Use sudo with password as parameter [closed]
- Shell script: Run function from script over ssh
- What is the difference between using `sh` and `source`?
- Get the Perl rename utility instead of the built-in rename
- Automating telnet session using bash scripts
- Run a shell command when a file is added
- How do I syntax check a Bash script without running it?
- Pass a password to ssh in pure bash
- extracting unique values between 2 sets/files
- Pattern match does not work in bash script
- Unable to export the variable through script file [duplicate]
- CURL to access a page that requires a login from a different page
- How do you normalize a file path in Bash?
- Extract one word after a specific word on the same line [duplicate]
- How do I remove newlines from a text file?
- Error “syntax error near unexpected token ‘(‘” in Bash script when selecting files
- pass stdout as file name for command line util?
- Code for parsing a key/value in in file from shell script
- How to have simple and double quotes in a scripted ssh command
- Recursively remove files
- How to show line number when executing bash script
- How to pass parameters to a Bash script?
- Add a newline only if it doesn’t exist
- Bash script to remove ‘x’ amount of characters the end of multiple filenames in a directory?
- How can I split one text file into multiple *.txt files?
- Using “$RANDOM” to generate a random string in Bash