Minha solução atual (consulte aqui para uma versão talvez mais recente ):
egrep "^export " ~/.profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$//")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$//")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$//")
if test $var = "PATH"
# replace ":" by spaces. this is how PATH looks for Fish
set value (echo $value | sed -E "s/:/ /g")
# use eval because we need to expand the value
eval set -xg $var $value
continue
end
# evaluate variables. we can use eval because we most likely just used "$var"
set value (eval echo $value)
set -xg $var $value
end