Re: New technote for "do shell script"
Re: New technote for "do shell script"
- Subject: Re: New technote for "do shell script"
- From: Doug McNutt <email@hidden>
- Date: Tue, 28 Jan 2003 17:15:16 -0700
At 11:07 -0800 1/28/03, Christopher Nebel wrote:
>
>
No, it's not. You're saying you've got a file that's marked executable and starts with "#!/bin/tcsh", right? If you trigger it by saying 'do shell script "my-login-script"', then what actually happens is this:
>
>
1. do shell script launches sh.
>
2. sh looks at the input "my-login-script" and determines that it's the name of an executable file.
>
3. It executes the file.
>
4. The system notices the "#!" (aka shebang) line, sees that it should use /bin/tcsh to run the file, and does so.
>
>
Once again: "do shell script" always uses sh to interpret its input. What happens in the commands that input triggers depends on the commands.
That option ought to be in the documentation while you're fixing it in accordance with Berkowitzs' suggestions..
It also explains just why $SHLVL is set to 2 as my script is actually executed. For a while I was convinced that "do shell script" was executing Terminal to cause that. It's now becoming clear that it's an instance of sh -or is it bash?. The docs really ought to be clear on the point. Is it the shell or the system that recognizes the shebang line? I sure can't put an execuable with a shebang line to the startup items plist. I have to give it a .command extension to get to Terminal or prepare an AppleScript APPL to do the work.
Does it follow that a #!usr/bin/perl line would do the same thing? Can I get to an executable produced by a gcc compile the same way? Is it "do SHELL script" or "execute an executable?"
And by the way, if I execute the script from WITHIN BBEdit does the invoked process get the environment variables from BBEdit? In particular, what it the value of $PATH? Remember that I might have attempted to redefine it in a BBEdit or Project Builder worksheet. (Think MPW if you feel like answering that one. OS neXt doesn't seem to understand.)
I remain truly confused and I would appreciate accurate documentation for simple things. Remember the KISS principle.
Personally, I'd settle for C-like syntax. But then I understand it's not your fault. It's Steve's dammit. Bring back Tognazzini.
<end rant>
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.