LoginSignup
0
0

More than 5 years have passed since last update.

fish-shellでズンドコキヨシ

Posted at

一年前くらいに流行っていたこれを唐突にやりたくなったので.
ズンドコキヨシまとめ

べつにシェル芸でもなんでもなく,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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0