0

時間のユーザー入力を受け入れ、現在の時間がユーザー入力の時間と等しい場合にプログラムを強制終了するスクリプトを作成しました。

次のように分類されます。

read -p "Enter when your class ends in the format 00:00 " endclass
echo "We will close your meeting at $endclass"


NOW=$(date +"%H:%M")
while True
do
  echo "Waiting for class to end..."
  if [ $NOW = $endclass ]
  then
    pkill Chrome
  fi
done

if ステートメントを while ループ内に配置して、現在の時刻が目的の時刻に達するまでスクリプトを実行し続けます。

エラーなしでスクリプトを実行できますが、Chrome はまったく停止しません。

任意のヒント?

4

1 に答える 1