How use shell on MacOS X ?

Dar Scott dsc at swcp.com
Sat Apr 6 12:08:01 EST 2002


On Saturday, April 6, 2002, at 04:00 AM, Ludovic Thébault wrote:

> Why the shell command doesn't works with MacOS X ?

I don't know why.  I hope it will soon.

In the mean time you might want to try this function that uses 
AppleScript.  I mentioned it on the list a couple weeks ago.  I 
have only used it a few times.

> I know nothing about AppleScript, but with a tiny bit of fooling 
> around I came up with this:
>
> function shellSH cmd
>   -- Sorry, no quote marks in cmd in this version
>   -- And shellCommand is ignored
>   put "do shell script" & quote & cmd & quote into s
>   do s as AppleScript
>   put result() into r
>   replace numToChar(13) with linefeed in r
>   return r
> end shellSH
>
> This uses sh and not tcsh that the Terminal program uses.

With out the replace command, the end-of-line sequence in returned 
text would be a single carriage return character.  This function 
replaces it with linefeed, the standard Revolution end-of-line 
symbol.

I had to use full paths when I used this.

Since I have hardly used this, I don't know all the problems 
involved with using this function.  Perhaps others have found some.

Dar Scott





More information about the use-livecode mailing list