As I’m not that versed in using shell scripts I am hoping someone can help me with a problem that has come up.
Before Snow Leopard I used the following command:
do shell script “echo PASSWORD | sudo chmod 0 /System/Library/CoreServices/TheApplicationTargeted”
but now I get the error message:
error “sudo: no tty present and no askpass program specified” number 1
I read somewhere that recent versions of sudo will refuse to prompt for a password if no
tty is present, but I’m not quite sure what that means or how to rewrite my command to solve the problem.
I thank you for your time and I look forward to hearing back from anyone who can help.
I usually figure this stuff out by experimenting with what I’m trying to do, but it’s a little dangerous to be doing SUDO anything, and this definately includes changing the permissions for anything in your /System/ folder.
Thank you elspub for the reply and I apologize for being slow in getting back to you. I should also apologize for the obviously confusing example I gave. It just so happened to be what first caught my eye but I should have used something else. The reason I was adjusting permissions in the System Folder was because I am running a Kiosk style setup where the only program running is my own (right from startup). I had asked a fellow programmer a few years back for a good way to disable Spotlight and he told me to change the permissions so that it wouldn’t start up in the account I was using. (In Snow Leopard the Spotlight feature has changed from being an app in the CoreServices Folder to…well, to something else.) Anyway, that method worked before, but that style of coding seems to have changed in Snow Leopard. For example (a better one than before):
set posixPath1 to quoted form of POSIX path of “HardDisk:Test_1:”
set posixPath2 to quoted form of POSIX path of “HardDisk:Test_2:”