mattly/bork

defaults.sh: line 21: [: =: unary operator expected

bcomnes opened this issue · 1 comments

When running bork types I get the following error from the defaults type:

bret-mbr:install bret$ bork types
...
/usr/local/Cellar/bork/HEAD/types/defaults.sh: line 21: [: =: unary operator expected
       defaults: asserts settings for OS X's 'defaults' system
                 * defaults domain key type value
                 > defaults com.apple.dock autohide bool true

Running GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin15.0.0) from hombrew.

Is it a matter of just changing https://github.com/mattly/bork/blob/master/types/defaults.sh#L21 to

if [ "${desired_type:0:4}" = "dict" ]; then

?

I'm realizing I have a massive knowledge deficit regarding bash variable expansion syntax 😬

frdmn commented

@bcomnes Good catch. Yes, I think escaping the variable is the right fix for this!

LGTM 👍