I'm trying to run the following line of script in bash on Mac OS X 10.6.4 (from this question):
$ export EDITOR='mvim -f -c "au VimLeave * !open -a Terminal"'
Alas, what I get is something unexpected:
$ echo $EDITOR
mvim -f -c "au VimLeave Desktop Documents Downloads Library Movies Music Pictures Public Sites bin !open -a Terminal"
The expected output would be:
$ echo $EDITOR
mvim -f -c "au VimLeave * !open -a Terminal"
The way to fix this to this is to set noglob
, i.e. run set -f
immediately prior to the export
assignment. However, the question at hand is whether this is the expected behaviour on Mac OS X because (because noglob
is unset by default, i.e. set +f
) or because there is a bug in bash
on Mac OS X.
The version of bash is:
$ bash --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc.
There may be some assistance by way of page 329 of A practical guide to Unix for Mac OS X users
: "Unless noglob (page 320) is set, the shell performs [pathname expansion] when it encounters an ambiguous file reference--a token containing any of the unquoted characters &, ?, [, or ].". However because the *
being globbed is within quotes, the question remains: Is the behaviour a default setting of bash, or a bug?
This is just a curiosity, but I'd be grateful for any thoughts and input you may have.
Brian