Hello,
I just try to write my first AppleScript that would aim to add lines at the very end of the hosts file.
set fileHosts to "/etc/hosts"
set hostToAdd to "#mes hosts à rajouter"
open for access fileHosts with write permission
write hostToAdd to fileHosts
write hostToAdd to fileHosts starting at eof
close access fileHosts
When I do a test file of my account, no problem, but when I do it on the real hosts file (in root account), I get the following error: “Error network file permission.”. The “network” seems to me strange, but speculates that it is a permission problem.
Are there means he asks the administrator password in order to save this file? And if possible, how to do it?
Thank you in advance.