mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 11:43:37 +08:00
52f8707c3e
It's a bit more explicit than replace.
16 lines
385 B
Fish
16 lines
385 B
Fish
function export --description 'Set global variable. Alias for set -gx, made for bash compatibility'
|
|
if test -z "$argv"
|
|
set
|
|
return 0
|
|
end
|
|
for arg in $argv
|
|
set -l v (string split -m 1 "=" -- $arg)
|
|
switch (count $v)
|
|
case 1
|
|
set -gx $v $$v
|
|
case 2
|
|
set -gx $v[1] $v[2]
|
|
end
|
|
end
|
|
end
|