From d3a3bf32634ac183d5578100bdfc34ae81290bf4 Mon Sep 17 00:00:00 2001 From: Waleed Gadelkareem Date: Thu, 4 Dec 2014 19:59:53 +0100 Subject: [PATCH] fix conflict between bash export and fish set global variables in profile.d add this to /etc/fish/config.fish to run your bash scripts in profile.d --- config/fish.config | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 config/fish.config diff --git a/config/fish.config b/config/fish.config new file mode 100644 index 0000000..e1cfda9 --- /dev/null +++ b/config/fish.config @@ -0,0 +1,66 @@ +# +# Init file for fish +# + +# +# Some things should only be done for login terminals +# + +if status --is-login + + # + # Set some value for LANG if nothing was set before, and this is a + # login shell. + # + + if not set -q LANG >/dev/null + set -gx LANG en_US.UTF-8 + end + + # Check for i18n information in + # /etc/sysconfig/i18n + + if test -f /etc/sysconfig/i18n + eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p') + end + + # + # Put linux consoles in unicode mode. + # + + if test "$TERM" = linux + if expr "$LANG" : ".*\.[Uu][Tt][Ff].*" >/dev/null + if which unicode_start >/dev/null + unicode_start + end + end + end +end + +set tmp_path $PATH +setenv PATH +for path in $tmp_path + setenv PATH $PATH $path ^ /dev/null +end + +# fix conflict between bash export and fish set global variables in profile.d +# add this to /etc/fish/config.fish to run your bash scripts in profile.d + +if status --is-login + for line in (sh --noprofile --norc -c '. /etc/profile; env') + set variable (echo $line | cut -d '=' -f 1) + set value (echo $line | cut -d '=' -f 2-) + # Convert to array + if test (echo $value | grep ":") + set value (echo $value | sed -e 's/:/\n/g') + end + if test $variable = PATH + for path in $value + setenv PATH $PATH $path ^ /dev/null + end + else + setenv $variable $value ^ /dev/null + end + end +end +