mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-25 20:41:15 -03:00
Commit f38646593c (Allow `export` to set colon-separated `PATH`, `CDPATH`
and `MANPATH`., 2017-02-10)
did something very weird for «export PATH=foo».
It essentially does
set -gx PATH (string replace -- "$PATH" (string join ":" -- $PATH) foo)
which makes no sense. It should set PATH to "foo", no need to involve the
existing value of $PATH.
Additionally, the string split / string join dance is unnecessary. Nowadays,
builtin set already handles path variables as is needed here, so get rid of
this special case.
Fixes #11434
18 lines
433 B
Fish
18 lines
433 B
Fish
function export --description 'Set env variable. Alias for `set -gx` for bash compatibility.'
|
|
if not set -q argv[1]
|
|
set -x
|
|
return 0
|
|
end
|
|
for arg in $argv
|
|
set -l v (string split -m 1 "=" -- $arg)
|
|
set -l value
|
|
switch (count $v)
|
|
case 1
|
|
set value $$v[1]
|
|
case 2
|
|
set value $v[2]
|
|
end
|
|
set -gx $v[1] $value
|
|
end
|
|
end
|