mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-30 14:53:11 +00:00
2c77b24ced
The BSD `seq` command handles `seq 0` weird.
18 lines
613 B
Fish
18 lines
613 B
Fish
# Show information about the named var(s) passed to us.
|
|
function show --no-scope-shadowing
|
|
for v in $argv
|
|
if set -q $v
|
|
set -l c (count $$v)
|
|
printf '$%s count=%d\n' $v $c
|
|
# This test is to work around a bogosity of the BSD `seq` command. If called with
|
|
# `seq 0` it emits `1`, `0`. Whereas that GNU version outputs nothing.
|
|
if test $c -gt 0
|
|
for i in (seq $c)
|
|
printf '$%s[%d]=|%s|\n' $v $i $$v[1][$i]
|
|
end
|
|
end
|
|
else
|
|
echo \$$v is not set
|
|
end
|
|
end
|
|
end
|