Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to find a bug in this test script, but haven't been able to so far. I'm not lazy, I promise...just new to Bash so am having a hard time catching syntax errors. I'd really appreciate it if someone could help me.

Here's the code. I call the script with the option -disableVenusBld, and it still prints "Starting build", which it shouldn't be doing right?

while [ $# -ne 0 ]
 case "$arg" in

if [ "$disableVenusBld" != true ]; then
 echo "Starting build"
share|improve this question
I just tried what you suggest and did not get Starting build when I supplied the -disableVenusBld flag. Can you give more information (i.e. system configuration, any output from the script when you run it, etc.) – dtlussier Sep 9 '10 at 20:17
Ugh, typo on my part. I'm stupid like that lol. Thanks guys. – iman453 Sep 9 '10 at 20:23
up vote 4 down vote accepted

I can't see anything wrong with your script, and it does what you expect when I run it:

$ bash -x
+ '[' 0 -ne 0 ']'
+ '[' '' '!=' true ']'
+ echo 'Starting build'
Starting build
$ bash -x -disableVenusBld
+ '[' 1 -ne 0 ']'
+ arg=-disableVenusBld
+ case "$arg" in
+ disableVenusBld=true
+ shift
+ '[' 0 -ne 0 ']'
+ '[' true '!=' true ']'

Note that I ran the script with bash -x. This causes all the lines beginning with + to be printed: you get a trace of the execution of your script. Do the same with your actual script to figure out where the problem is.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .