I use xcode to create my Bash scripts. When you make a new script file it will put the right format in there to start with. All Scripts start with
As the very first line.
Then it gets your script bit inserted on the lines following that.
You are on a Mac and want the # symbol, its Alt + 3.
Save the file. It needs to be executable, so it needs permissions to do this. For that I use the chmod command in Terminal.
chmod -Rf 777 /Path/to/File.sh
That will make the file executable by everyone and readable by everyone and writable by everyone.
The numbers are for Owner, Group, Others
Read = 4
Write = 2
Execute = 1
Add up what you want in the 3 numbers and put it in.
Read and write and execute for the Owner 4+2+1=7
Read and execute for the Group 4+1=5
Read and execute for Others 4+1=5
There are other ways to achieve this. This is just the way I do it.
If you run the script from Jamf, you shouldn't need the sudo, as the script will be running as the root superuser.
Your script will be along these lines...
#!/bin/sh sh -c 'echo "Sandboxing Relaxed" >> /etc/cups/cups-files.conf' launchctl stop org.cups.cupsd
Running the script locally like that will give a permission error. It needs to be run as root without the sudo.
Try in Jamf > Computers > Management Settings > Computer Management > Scripts
Make a new script and paste the script in there. Then use Jamf to push it out to the device. If it is a quick test you can use JAMF Remote to find the test Mac and the script you just saved and run it.
This should not get the errors, because it is run as root by the JAMF system.