Hi Folks,

An important tip for RB Shell class users - REALbasic uses the /bin/ sh executive instead of /bin/bash when executing the command supplied. The issue is that the version of /bin/sh shipping with Tiger **WON'T** execute fat binary command line tools such as grep, cat, sudo ... You'll see this in your Shell's output as:

        sh: -c: line 1: unexpected EOF while looking for matching `''
        sh: -c: line 2: syntax error: unexpected end of file

Here is more detail from within a Terminal:

        pc-00179:~ tjones$ file /usr/bin/grep
        /usr/bin/grep: Mach-O universal binary with 2 architectures
        /usr/bin/grep (for architecture i386):   Mach-O executable i386
        /usr/bin/grep (for architecture ppc):    Mach-O executable ppc

        pc-00179:~ tjones$ sh grep -a tiger1 /etc/hosts
        grep: /usr/bin/grep: cannot execute binary file

        pc-00179:~ tjones$ which sh
        /bin/sh

        pc-00179:~ tjones$ file /bin/sh
        /bin/sh: Mach-O universal binary with 2 architectures
        /bin/sh (for architecture i386):        Mach-O executable i386
        /bin/sh (for architecture ppc): Mach-O executable ppc


I've bug reported this to Apple as it is definitely an issue.

I the mean time, if you wrap your shell.execute calls in a "bash -c '... '" wrapper, this will work as expected:

        shMyshell.Execute "grep -a my-string " + myUnixFile"

becomes

        shMyshell.Execute "bash -c 'grep -a my-string " + myUnixFile'"

This will now work under Tiger systems running fat binary command line tools. Note that this will also work on platforms where /bin/sh is actually /bin/bash, so refactoring with this change won't break your shell calls on non-Mac OS X 10.4 systems.

Hopefully this will help some of you before you lose a few nights of sleep.

Tim
--
Tim Jones                                       [EMAIL PROTECTED]


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to