Quick question regarding a shell script

Joined
Oct 10, 2009
Messages
48
Reaction score
0
Points
6
Location
Boston, MA
Your Mac's Specs
27" iMac, 17" MBP, Mini x2
Hi folks,

I have a handful of shell scripts that I use to rsync a webserver that I run. Nothing fancy, just a one-liner in each of them. An example would be:

!/bin/bash
rsync -av /volumes/Macintosh\ HD/Users/me/Folder /volumes/Backup-Drive/Folder

The scripts run just fine if I copy/paste the rsync line into a command prompt, and all but one of them runs with a single click if I rename the files to .command so that they'll spawn on their own.

One of them, however, gives me an "operation not permitted" error:

-bash: /Users/me/Scripts/script.command: Operation not permitted
logout
[Process completed]

I'm not entirely sure why. I've tried recreating the file, chmod 777 and +x, and for some reason just this one script refuses to run. If I paste the contents of the file into a terminal window, it executes just fine.

Anyone run into this? What am I missing? :) I've tried it with a !/bin/sh and a #!/bin/sh in front of it, and without the bash call altogether - same error.

Thanks!
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Your shebang (#!/bin/bash), malformed as !/bin/bash should return as something like..

line 1: !/bin/bash: No such file or directory

run a mount.. and make sure the FS you're running this on isn't noexec.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top