I need to check the command executed is success or not, I have place the below code in test.sh run it, which give the out by listing the content of /home but there is a warning ./test.sh: 3: ./test.sh: [[: not foundWhat's wrong in below command#!/bin/shls /home/if [[ $? != 0 ]]; thenecho Commnad Errorelseecho Commnad Successfi
Linux shell script check command success
shell script;test
According to error:./test.sh: 3: ./test.sh: [[: not foundYour /bin/sh isn't bash and [[ is bash-specific. Use single bracket [ or test command by itself.And also use -ne for numeric conditionals. != will work in your specific case, but it's bad practice.