fish-shell/share/functions/export.fish
Fabian Homborg 54f215294f export: Fix replacing
Also run it through fish_indent
2015-10-12 11:35:45 +02:00

18 lines
532 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
# Only split on the first =
# The literal "\n" is necessary because string doesn't interpret it without -r
set -l v (echo $arg | string replace "=" \n)
set -l c (count $v)
switch $c
case 1
set -gx $v $$v
case 2
set -gx $v[1] $v[2]
end
end
end