Re: Do shell script vs terminal discrepancy
Re: Do shell script vs terminal discrepancy
- Subject: Re: Do shell script vs terminal discrepancy
- From: Doug McNutt <email@hidden>
- Date: Fri, 4 Dec 2009 15:44:44 -0700
At 16:23 -0500 12/4/09, Paul Skinner wrote:
>the fact that do shell script ignores the configuration files that an
>interactive shell would read. So there's no $PATH extending, so no non-
>default path installed tools are available.
> Even if I call the tool with a full path this will always fail
>because it won't have access to the dependencies that imagemagik
>requires. It's not possible unless I could build IM in a default path
>for sh shell.
> Oh well, it's not like I could distribute this script with an IM
>dependency anyway. I spent 3 hours installing and updating macports,
>rubygems and IM just to get this to run properly in the terminal. And
>I certainly wouldn't think of futzing around with the install paths. I
>wonder if it is possible to somehow get the default sh shell paths to
>see the tools using symlinks and such. No, I'd probably just shoot
>myself in the foot with the terminal.
> Back to square one.
You're calling convert which is part of imagemagik.
You'll find that the default path set up by the OS is
/bin:/sbin:/user/bin:/usr/sbin
to which there may be added. if it's present, a bin directory in the user's home folder.
If you think you need more in $PATH, like stuff that a user has put into his own private places and they get set up only when the user's .tcshrc or .profile or yet more you can do that by placing the shell script you need into a temp file that starts with #!/bin/sh or #!/bin/tcsh or something else. Those calls will start a new shell of your choice which will source the startup files. It's also easy to add multiple lines to your script without worrying about those semicolons.
But my $HOME/.tcshrc file doesn't do anything special for imagemagik and things pretty much work, at least on 10.3.9 which I'm limited to for hardware reasons.
The dependencies in the tool should have installed themselves in places that the tool requires. You shouldn't have to worry about that if you can find the starting point.
"which convert" is good advice. I suspect you'll find that it's already in the path you get from AppleScript. But if it's not, a full path ought to work for everyone.
And. . . you can also script Apple's Terminal.app. Tell terminal to do script is functional. Terminal, when it starts up will source the user's initialization files. With Terminal you can also run a script in a named window. That way you can change environment variables and expect them to be there when you get back.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
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