Closed glasser closed 7 years ago
Note: I don't know much about zsh and haven't tested there.
Good finds. Hadn't heard about shellcheck before but installed it right away, seems to give good suggestions.
BTW, as far as dropping the eval
in globalExec: keeping it in seemed to break vg globalExec echo 'foo bar'
and I think it still allows for most of the things you'd expect from an eval (eg you can globalExec a cd and it works), but I'm not an expert.
The most important bits here are quoting the $@ invocations, especially in vg globalExec; without this, trying to pass arguments containing spaces to the program exec'd by vg globalExec will fail. Some other instances are helpful if your home directory has a space in its path. Some of the other quotes are perhaps extraneous (eg, with echo), but it's a good habit to be in anyway.