1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.ja/common/case.md
Sebastiaan Speck e52bff3e50
case: update Japanese translation (#11556)
Use recommended More information translation for the page
2023-11-22 10:09:19 +05:30

595 B

case

複数の選択肢がある条件文を作成するための Bash 組み込み構文。 詳しくはこちら: https://www.gnu.org/software/bash/manual/bash.html#index-case

  • 変数を文字列リテラルとマッチさせ、実行するコマンドを決める:

case {{$tocount}} in {{words}}) {{wc -w README}}; ;; {{lines}}) {{wc -l README}}; ;; esac

  • パターンは | で結合し、どれにも該当しないパターンには * を使う:

case {{$tocount}} in {{[wW]|words}}) {{wc -w README}}; ;; {{[lL]|lines}}) {{wc -l README}}; ;; *) {{echo "what?"}}; ;; esac