Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A shell script to edit text files as root in the GUI' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A shell script to edit text files as root in the GUI
Authored by: davidbodonnell on Aug 31, '04 02:23:32PM

Why not just use

sudo open -a $APPLICATION $FILE

e.g.,

sudo open -a BBEdit /var/log/foo.log

[ Reply to This | # ]
A shell script to edit text files as root in the GUI
Authored by: aqsalter on Sep 01, '04 12:40:29AM

This does not work because you are running "open" as root, but BBEdit still runs as yourself.
The suggestion above about "authopen" may do the trick. (or the current hint also works of course ;)



[ Reply to This | # ]
A shell script to edit text files as root in the GUI
Authored by: davidbodonnell on Sep 01, '04 05:14:10PM

Ah, I see where the problem lies: most of the files I wanted to look at were owned by root:admin, and I am in the admin group. Of course, if you open a file that is outside your group, BBEdit (the application I chose to test) will just ask for your admin password when you Save it and will proceed to save away.

Personally, if I am going to drop to the CLI to edit files, I'll just stick with emacs :)



[ Reply to This | # ]