mattly / bork

the Bash-Operated Reconciling Kludge
Other
218 stars 29 forks source link

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

Closed bcomnes closed 8 years ago

bcomnes commented 8 years ago

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 8 years ago

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

LGTM 👍