Sublime Forum

Shell script syntax coloring bug

#1

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:

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

[code]#!/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
}
[/code]

0 Likes

#2

For now, I’m using this workaround:

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.

0 Likes