mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Added export
alias for set global variable, made for sh/bash/zsh compatibility
Signed-off-by: Rack Lin <racklin@gmail.com> Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
This commit is contained in:
parent
019c0fed23
commit
bfd1951023
1 changed files with 16 additions and 0 deletions
16
share/functions/export.fish
Normal file
16
share/functions/export.fish
Normal file
|
@ -0,0 +1,16 @@
|
|||
function export --description 'Set global variable. Alias for set -g, made for bash compatibility'
|
||||
if test -z "$argv"
|
||||
set
|
||||
return 0
|
||||
end
|
||||
for arg in $argv
|
||||
set -l v (echo $arg|tr '=' \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
|
Loading…
Reference in a new issue