Scripting Mac OS X
Subject:   Making and running scripts
Date:   2004-10-01 15:29:37
From:   jamesreynolds
Response to: Making and running scripts

I haven't seen this exact error, so I am not sure off hand. But here is the debugging steps I would go through.

What did you use to edit the script? Are you sure it saved a text file? Are you sure it has Unix line endings?

How did you execute it? Did you change the permissions on the file so that it is executable? Did you specify the interpreter by typing:

bash script

Or did you type


I can tell that bash tried to execute the script, because of the message (the first word is bash). That shouldn't be happening because you specify perl on the first line of the script.

Also, echo is a shell command, not a perl command, so it wont work anyway. I get this message:

String found where operator expected at ./script line 2, near "echo "Hello""
(Do you need to predeclare echo?)
syntax error at ./script line 2, near "echo "Hello""
Execution of ./script aborted due to compilation errors.

The perl command is print (and perl lines have to end with ":"):


print "Hello\n";

1 to 1 of 1
  1. Making and running scripts
    2004-10-01 15:30:59  jamesreynolds [View]

1 to 1 of 1