14 Feb
2017
14 Feb
'17
8:12 a.m.
Query awk for the list of environment variables, instead of trying to extract the list from the output of `env`: the old approach breaks when any of the environment variable contains more than one line. --- dib/dib.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dib/dib.ml b/dib/dib.ml index 71b1f7f..54ea2ae 100644 --- a/dib/dib.ml +++ b/dib/dib.ml @@ -289,7 +289,7 @@ if [ -n \"$user\" ]; then fi if [ -z \"$preserve_env\" ]; then - for envvar in `env | grep '^\\w' | cut -d= -f1`; do + for envvar in `awk 'BEGIN{for (i in ENVIRON) {print i}}'`; do case \"$envvar\" in PATH | USER | USERNAME | HOSTNAME | TERM | LANG | HOME | SHELL | LOGNAME ) ;; BASH_FUNC_* ) unset -f $envvar ;; -- 2.9.3