Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script called buildgcc.sh with the following contents.

mymac$more buildgcc.sh 
g++ -Wno-write-strings A.cpp B.cpp B.cpp c.cpp D.cpp E.cpp F.cpp artgdg.cpp G.cpp H.cpp I.cpp J.cpp K.cpp L.cpp M.cpp N.cpp O.cpp P.cpp

When I run the script I get an error:

mymac$./buildgcc.sh
No such file or directory+-4.2: P.cpp

But when I copy/paste the contents of the script into the command line:

mymac$g++ -Wno-write-strings A.cpp B.cpp B.cpp c.cpp D.cpp E.cpp F.cpp artgdg.cpp G.cpp H.cpp I.cpp J.cpp K.cpp L.cpp M.cpp N.cpp O.cpp P.cpp
mymac$

It works fine... anyone give me a clue what's going on here?

share|improve this question

1 Answer 1

You need to put

#!/bin/sh

at the start of your script. Otherwise the system has no idea what the heck that .sh file is.

Alternately, you could do

sh buildgcc.sh

at the command line.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.