bash-powerline
bash-powerline copied to clipboard
Use a function to wrap git
This allows bash-powerline to work on macOS, which has Bash 3.
@riobard Are you accepting PRs in this repo?
Could you please explain a little bit why this PR is needed? The current code works with Bash 3 on macOS.
@riobard No, the current code does not work on macOS with Bash 3. That is why I submitted this PR. The current code silently fails, looking for a binary with name "env LANG=C git".
That's strange. What's the version of your macOS and its bash?
Bash is "3.2.57(1)-release (x86_64-apple-darwin18)" and macOS version is 10.14.5.
Easy to repro:
$ prog="X=Y ls"
$ $prog
-bash: X=Y ls: command not found
No, you're doing it wrong. Try cmd="env LANG=C git and run $cmd. It definitely works unless your $PATH is screwed.
$ cmd="env X=Y ls"
$ $cmd
-bash: env X=Y ls: command not found
I guess your bash might be misconfigured.
bash-3.2$ uname -a
Darwin Mac-mini 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
bash-3.2$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2$ cmd="env LANG=C git"
bash-3.2$ $cmd --version
git version 2.20.1 (Apple Git-117)
bash-3.2$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin