一年前くらいに流行っていたこれを唐突にやりたくなったので.
ズンドコキヨシまとめ
べつにシェル芸でもなんでもなく,fishのビルトインだけで素直に書いた.というか,fish shellならビルトインコマンド・ビルトイン関数だけで書ける.
変わったことをしているのは,配列を文字列に埋め込むと空白区切りになる,ということくらい.
function zundoko
set -l stack
while true
test (count $stack) -gt 4
and set -e stack[1]
set -l call (random choice "ズン" "ドコ")
echo $call
set stack $stack $call
test "$stack" = "ズン ズン ズン ズン ドコ"
and echo "キ・ヨ・シ!"
and break
end
end