Home Download Buy Blog Forum Support

Shell script syntax coloring bug

Shell script syntax coloring bug

Postby ZevEisenberg on Wed Aug 29, 2012 5:52 pm

I'm using the xcode-select command in a shell script to find the currently selected version of Xcode and open it. SublimeText seems to think the "select" part of "xcode-select" is the "select" statement, and colors it accordingly. The problem is that syntax coloring breaks after that point:

Image

Here's the text of the same script in case you want to play with it:

Code: Select all
#!/bin/sh

function properFunction
{
    echo "do a thing"
    echo "do more things"
} # <-- proper color of a closing brace

properFunction()

function thing1
{
    xcodePath=`xcode-select -print-path`/../..   # <-- "xcode-select" is one command and should be all one color
    open $xcodePath
} # <-- this closing brace doesn't get colored correctly

function thing2
{ # <-- wrong color
    echo "here is some testing" # <-- the "echo" token should be gray as in properFunction, lines 5 & 6
    thing1() # <-- the parentheses should be gray as in line 9
}
ZevEisenberg
 
Posts: 3
Joined: Tue Aug 21, 2012 4:17 pm

Re: Shell script syntax coloring bug

Postby ZevEisenberg on Wed Aug 29, 2012 5:56 pm

For now, I'm using this workaround:

Code: Select all
xcodeselect="xcode-select"
open `$xcodeselect -print-path`/../..


Oh, and "-print-path" is not a typo. Both -print-path and --print-path work, but the man page lists it with a single dash.
ZevEisenberg
 
Posts: 3
Joined: Tue Aug 21, 2012 4:17 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 9 guests