0

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)

1
  • what does ls -l /Users/user_name/Desktop/$1/watch.command show (replacing $1 by an actual directory
    – mmmmmm
    Commented Sep 2, 2016 at 18:52

2 Answers 2

1

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

0

Make your script executable with

chmod +x $YourFile

See man chmod for more details, or https://ss64.com/osx/chmod.html or https://en.wikipedia.org/wiki/Chmod

You must log in to answer this question.

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