#!/bin/bash q1=quiz1.txt echo "What's your number?" | tee $q1 #"What's your number?"と画面に表示し、さらにquiz1.txtに書き込みます read number #好きな二桁の整数を読み込みます echo $number >> $q1 #二桁の整数をquiz1.txtに書き込みます while [ $number != $1 ]; do #引数と入力した整数が一致しなければdoからdoneまでのコマンドを実行します   if test $number -lt $1 then #もし入力した整数が引数より小さければ"Your number is smaller than the answer"と画面に表示し、さらにquiz1.txtに書き込みます echo "Your number is smaller than the answer" | tee -a $q1   else #もし入力した整数が引数より大きければ"Your number is larger than the answer"と画面に表示し、さらにquiz1.txtに書き込みます echo "Your number is larger than the answer" | tee -a $q1 fi echo "What's your number?" | tee -a $q1 read number echo $number >> $q1 done echo "Your number matches the answer!!" | tee -a $q1 #引数と入力した整数が一致すれば"Your number matches the answer!!"と画面に表示し、さらにquiz1.txtに書き込みます