Re: How to Run a "sudo" Terminal Command
Re: How to Run a "sudo" Terminal Command
- Subject: Re: How to Run a "sudo" Terminal Command
- From: Christopher Nebel <email@hidden>
- Date: Tue, 12 Jan 2016 15:03:38 -0800
On Jan 10, 2016, at 12:04 AM, Christopher Stone <email@hidden> wrote:
> On Jan 09, 2016, at 18:20, Christopher Nebel <email@hidden> wrote:
>
>> One is to use Script Menu, which supports executable shell scripts.
>
> That's not self-contained as Steve was requesting, but it works well (and few people seem to know the Script Menu will run shell scripts).
>
> I use FastScripts for this sort of thing, because it does everything the System Script Menu does and has global and app-specific keyboard shortcuts. Demo mode allows unlimited scripts but only 10 assignable keyboard shortcuts. The full version unlocks unlimited keyboard shortcuts and costs $9.95 U.S. ( I've used it happily since 2003 – obviously I like keyboard shortcuts. :)
Yes, but it requires less packaging, and as you say is frequently overlooked. I interpreted “self-contained” as “doesn’t launch Terminal”, though looking again I see that he did specifically say “launch from Finder.”
>> Two is to embed it in an application bundle as the main executable. You then have a double-clickable application that executes your script without involving Terminal.
>
> Cool. I was completely unaware of this.
>
> Just tested it.
>
> I'm surprised you can replace the applet file with a plain text shell script, but it works perfectly.
If you plan to do this a bunch, you should trim down the Info.plist file to just the necessary bits. In particular, assuming you started from an AppleScript applet, you should remove the LSMinimumSystemVersionByArchitecture and LSRequiresCarbon keys.
The fact that this works is simply the nature of Unix: an “executable” is defined as either an executable object file or a file of data for an interpreter, i.e., a file beginning with a line of the form “#! interpreter”, which is nominally, but not necessarily, followed by plain text. Callers neither care nor know which kind of file they’re referring to, so they both work.
—Chris Nebel
Applescript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden