0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

多言語FizzBuzzAdvent Calendar 2022

Day 17

多言語FizzBuzzチャレンジ17日目:Shell script(bash)

Last updated at Posted at 2022-12-16

これまでのまとめ

本日のお品書き

唐突なshell(bash)。(何を書こうか思いつかなかったんです…)

FizzBuzz

for i in $(seq 1 100); do
    if [ $((i%15)) -eq 0 ]; then
        echo "FizzBuzz"
    elif [ $((i%3)) -eq 0 ]; then
        echo "Fizz"
    elif [ $((i%5)) -eq 0 ]; then
        echo "Buzz"
    else
        echo $i
    fi
done

おまけ:実行方法

スクリプトをファイルに書いておいて、実行権限付けてあげるだけですね。

# edit fizzbuzz.sh
chmod 755 fizzbuzz.sh
./fizzbuzz.sh
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?