# only apply profile.env for login shells, as we'd like fish to # inherit existing shell environment without overriding it if status --is-login # since fish supports export via upstream provided function # we can source directly, only ommiting $PATH and comments. grep -Ev "^(#|export (PATH|ROOTPATH)=)" /etc/profile.env | source # strip unneded stuff from bash export lines # apply paths and cleanup if [ "$EUID" = "0" ] ; or [ "$USER" = "root" ] set -l _rootpath (grep -o " ROOTPATH='.*'" /etc/profile.env | sed "s@.*'\(.*\)'@\1@;s@:@\n@g") set -xg PATH /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $_rootpath else set -l _userpath (grep -o " PATH='.*'" /etc/profile.env | sed "s@.*'\(.*\)'@\1@;s@:@\n@g") set -xg PATH /usr/local/bin /usr/bin /bin $_userpath end # Re-prepend $fish_user_paths __fish_reconstruct_path end