Access permissions for command file created with bash

I wrote myself a simple bash script which is a wrapper for compass create function, plus it creates a command file in the directory for compass watch (so that instead of manually typing out the directory and watch every time, I just double click on an icon in the project folder). The problem is that I get the following error when opening the command file:

The file “watch.command” could not be executed because you do not have appropriate access privileges. To view or change access privileges, select the file in the Finder and choose File > Get Info.

I can run it from the terminal with bash watch.command (assuming I'm in the appropriate directory). I tried changing the permissions in finder for the file as well as the folder (read and write for everyone), but I still get the same error (plus I don't want to change permissions manually every time).

Also, if I open text mate and make exactly the same file and save it to my project directory, it runs as expected.

Here is the code for my new_project command:

#!/bin/bash
compass create "/Users/user_name/Desktop/$1" --bare --sass-dir "scss" --css-dir "css" --javascripts-dir "js" --images-dir "images";
echo "#!/bin/bash" >> "/Users/user_name/Desktop/$1/watch.command";
echo "cd /Users/user_name/Desktop/$1" >> "/Users/user_name/Desktop/$1/watch.command";
echo "compass watch" >> "/Users/user_name/Desktop/$1/watch.command";

(the $1 argument is the project name)


Solution 1:

chmod 700 watch.command Now try double clicking the file.