Jump to content

Shell Scripting (Bash) Problem


foodfightr
 Share

5 posts in this topic

Recommended Posts

So I've tried writing a bash script (.sh) to configure my OS X preferences and every time I run it, it says "permission denied."

 

#!/bin/bash

# Disable shadow in screen window captures
# http://www.macosxhints.com/article.php?story=20080629181121863
defaults write com.apple.screencapture disable-shadow -bool true

# Change default screenshot format from PNG to JPG
# http://www.macosxhints.com/article.php?story=20050627224051361
defaults write com.apple.screencapture type jpg

# Show Bonjour in screen sharing application
# http://www.macworld.com/article/131094/2007/12/screensharepower.html
defaults write com.apple.ScreenSharing ShowBonjourBrowser_Debug 1

# Additional functionality in screen sharing application
# http://www.macworld.com/article/131094/2007/12/screensharepower.html
defaults write com.apple.ScreenSharing \
'NSToolbar Configuration ControlToolbar' -dict-add 'TB Item Identifiers' \
'(Scale,Control,Share,Curtain,Capture,FullScreen,GetClipboard,SendClipboard,Qu
lity)'

 

my-mac:desktop Joe$ ./personalize.sh
-bash: ./personalize.sh: Permission denied
my-mac:desktop Joe$ sudo -s
bash-3.2# personalize.sh
bash: personalize.sh: command not found
bash-3.2# ./personalize.sh
bash: ./personalize.sh: Permission denied

Link to comment
Share on other sites

So I've tried writing a bash script (.sh) to configure my OS X preferences and every time I run it, it says "permission denied."

 

#!/bin/bash

# Disable shadow in screen window captures
# http://www.macosxhints.com/article.php?story=20080629181121863
defaults write com.apple.screencapture disable-shadow -bool true

# Change default screenshot format from PNG to JPG
# http://www.macosxhints.com/article.php?story=20050627224051361
defaults write com.apple.screencapture type jpg

# Show Bonjour in screen sharing application
# http://www.macworld.com/article/131094/2007/12/screensharepower.html
defaults write com.apple.ScreenSharing ShowBonjourBrowser_Debug 1

# Additional functionality in screen sharing application
# http://www.macworld.com/article/131094/2007/12/screensharepower.html
defaults write com.apple.ScreenSharing \
'NSToolbar Configuration ControlToolbar' -dict-add 'TB Item Identifiers' \
'(Scale,Control,Share,Curtain,Capture,FullScreen,GetClipboard,SendClipboard,Qu
lity)'

 

my-mac:desktop Joe$ ./personalize.sh
-bash: ./personalize.sh: Permission denied
my-mac:desktop Joe$ sudo -s
bash-3.2# personalize.sh
bash: personalize.sh: command not found
bash-3.2# ./personalize.sh
bash: ./personalize.sh: Permission denied

 

You can do this in AppleScript with Script Editor :-

 

do shell script "defaults write com.apple.screencapture disable-shadow -bool true" with administrator privileges

Link to comment
Share on other sites

spotlight>search for script editor>write:

 

do shell script "defaults write com.apple.screencapture disable-shadow -bool true" with administrator privileges

do shell script"defaults write com.apple.screencapture type jpg" with administrator privileges

do shell script "defaults write com.apple.ScreenSharing ShowBonjourBrowser_Debug 1" with administrator privileges

 

save as whatever you want. Make sure you save it as an application though.

 

dont know how to do the last one. sorry!

Link to comment
Share on other sites

 Share

×
×
  • Create New...