Reputation: 141
I've been arguing with this code all morning. It finally dawned on me, upon reading TL;DP that my if statements may be confusing output redirection with a comparison.
The code in question is:
#!/bin/sh
...
if [ $DEBUG_LEVEL > 2 ]
then
echo "I made it here"
echo "DEBUG: created run_all_somatic_SNV_steps" >>$LOG
fi
Is my if statement confusing stderr redirection with what I want it to do? (compare a variable to the number 2)
Upvotes: 0
Views: 128
Reputation: 241771
For general shell:
if [ $DEBUG_LEVEL -gt 2 ]
(But that will fail if DEBUG_LEVEL
has never been set.)
More bash-specific, and a lot nicer:
if (( DEBUG_LEVEL > 2 ))
Upvotes: 2