elif ["$input" = "No"];次に、次の文を入力してください。

elif [
#!/bin/bash

input=""

echo "Does a wall needs to be sent?"
read input

if [ "$input" = "yes" ]; then
    echo "Sending message to all user about a system reboot or shutdown"|wall
elif [ "$input" = "no" ]; then
    exit
fi

echo "Is this a reboot or shutdown?"
read input

if [ "$input" = "reboot" ]; then
    echo "System is rebooting"
    shutdown -r +1
elif [ "$input" = "shutdown" ]; then
    echo "System is about to shutdown"
    shutdown -h +1
fi

echo "Goodbye"

私が見つけようとしているのは、壁を送らなければ「再起動ですか、それとも終了ですか?」というプロンプト文を受け取りたいということです。

壁に送りたくないときにスクリプトを終了するのではなく、どうすればよいですか?

ベストアンサー1

2行削除:

elif [ "$input" = "no" ]; then
    exit

行動をよくする必要があります。

おすすめ記事