Server Fault is a question and answer site for system and network administrators. 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'm new to bash and can't seem to get it to compile some C code without annoying messages. I'm quote sure it's the semicolons because if I remove or change them at all it will pretty much break. The warnings/errors I get are ": not found: :" with nothing else repeatedly for every line. Any help is appreciated.

GCC=/usr/bin/gcc ;
INSERTS="10000 20000 50000 100000 150000 250000 375000 500000 750000 1000000"
#compile with options
$GCC -DDEBUG -o codetest $CODESRC;
#run with parameters
./codetest $INSERTS;


The code compiles and runs fine. If I remove all the semicolons and try to run it using sh I get the following. 6: /usr/bin/gcc
: not found 8: ./codetest: not found

edit: Ahh, silly me; it was a windows/unix line endings problem, became apparent when running ./ and getting /bin/bash^M: bad interpreter

share|improve this question
up vote 1 down vote accepted

The semicolons shouldn't be necessary, but other than that the script looks ok.

  • Can you be more specific about the errors you're getting?
  • Does the code compile and run correctly when you try it outside of the script?
  • How are you running the script?


  • As that definitely the location of gcc? What is the output of which gcc
  • Are you running the script from the same directory as your code?
  • Since your script specifies that it should be ran with /bin/bash you should run it as ./, not sh
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.