Re: Fink and 'sh'
Re: Fink and 'sh'
- Subject: Re: Fink and 'sh'
- From: Graff <email@hidden>
- Date: Mon, 22 Mar 2004 10:25:58 -0500
On Mar 22, 2004, at 7:12 AM, Walter Ian Kaye wrote:
At 11:33a +0100 03/22/2004, Brennan didst inscribe upon an electronic
papyrus:
On 21/3/04 at 19:50, Graff <email@hidden> wrote:
> Try using the explicit path of the command. To find out where
LAME is,
> do this in the shell:
> where LAME
>
> It is probably located at /sw/bin/lame, so to use it do:
> do shell script "/sw/bin/lame blah blah blah"
Hmm. In other words, the 'best' practice is probably something like
this:
try
set lame to (do shell script "where lame")
on error msg number n
if n is -127 then -- UNIX command not found (i.e. not installed)
-- point user to source of command
display dialog "LAME not installed. Go on the net and get it?"
open location "http://www.culater.net/osd/packages.html"
else
error number n
end if
end try
do shell script (lame & " " & myinputfile & " " & myoutputfile)
No, not those other words.
However, I can't seem to call 'where' with 'do shell script'.
What he meant by "do this in the shell" was "do this in your shell in
Terminal, and then hard-code the path into your script."
In terminal, 'where where' tells me that 'where' is built in to the
shell.
Presumably 'where' is *not* built into 'sh', as evidenced by do shell
script "where where". Does 'sh' have an equivalent of 'where'?
That would be pointless. `where` (or `which`) relies on the PATH
variable in order to locate the file, so you would have a catch-22
thingie or whatever.
That is indeed what I meant.
I didn't realize it but where is a shell built-in for tcsh. It's such
a useful command that I just assumed it was more widely available.
One method for doing this totally via AppleScript would probably be to
do something like:
-------------
try
set haveLAME to do shell script "/bin/tcsh -c 'where lame"
if haveLAME is not equal to "" then
set lamePath to first paragraph of haveLAME
do shell script lamePath & " " & myinputfile & " " & myoutputfile
end if
on error
display dialog "LAME not installed. Go on the net and get it?"
open location "
http://www.culater.net/osd/packages.html"
end try
-------------
-Ken
_______________________________________________
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.