mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
change-time: Test date exit status directly
There's no need to try to parse stdout/stderr to figure out if date succeeded, just check if it was successful directly. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
770815cba8
commit
a1343666d5
@ -49,11 +49,7 @@ min=$value
|
||||
get_date "second" "00" "59" "2"
|
||||
sec=$value
|
||||
|
||||
##getting the output of date -s
|
||||
OUTPUT=$(date -s "$year-$month-$day $hour:$min:$sec" 2>&1)
|
||||
|
||||
##if output is starting with the letter d which is the beginning of the error message then we do the script again
|
||||
if [[ ${OUTPUT} == d* ]]; then
|
||||
if ! date -s "$year-$month-$day $hour:$min:$sec" &>/dev/null; then
|
||||
echo "The date is not correct, press any key to try again"
|
||||
echo -e "\n"
|
||||
read -n 1 nothing
|
||||
|
Loading…
Reference in New Issue
Block a user