I have a bash variable depth and I would like to test if it equals 0. In case yes, I want to stop executing of script. So far I have:

zero=0;

if [ $depth -eq $zero ]; then
    echo "false";
    exit;
fi

Unfortunately, this leads to:

 [: -eq: unary operator expected

(might be a bit inaccurate due to translation)

Please, how can I modify my script to get it working?

6 Answers
6

Leave a Reply

Your email address will not be published. Required fields are marked *