#!bin/bash echo "" > quiz1.txt echo "What's your number ?" echo "What's your number ?" > quiz1.txt read a # 数当ての標的となる数値を端末上から入力 echo $a >> quiz1.txt echo "Type any number!" echo "Type any number!" >> quiz1.txt read b echo $b >> quiz1.txt while [ $b -ne $a ]; # 代入した値が乱数と一致するまで繰り返すループ do if [ $b -ne $a ]; then if [ $b -lt $a ]; then echo "What a pity! This number is too Small for the argument. Type another number." # 乱数より小さいことを表す表示 echo "What a pity! This number is too Small for the argument. Type another number." >> quiz1.txt read b echo $b >> quiz1.txt else echo "What a pity! This number is too Big for the argument. Type another number." # 乱数より大きいことを表す表示 echo "What a pity! This number is too Big for the argument. Type another number." >> quiz1.txt read b echo $b >> quiz1.txt fi fi done echo "Congratulation! This number agrees with the argument." echo "Congratulation! This number agrees with the argument." >> quiz1.txt