diff options
author | 2014-11-28 19:48:11 +0800 | |
---|---|---|
committer | 2014-12-01 15:43:57 +0800 | |
commit | bfd1951023f4c76ef451f809639e9327432db232 (patch) | |
tree | 5513ee16e3da61e7e1b62fac1ef0e4d6e7a95d3c /share/functions/export.fish | |
parent | 019c0fed23ca1bfbe0931fc9eb48a344a34acb28 (diff) |
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>
Diffstat (limited to 'share/functions/export.fish')
-rw-r--r-- | share/functions/export.fish | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/share/functions/export.fish b/share/functions/export.fish new file mode 100644 index 00000000..e655c166 --- /dev/null +++ b/share/functions/export.fish @@ -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 |