mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
change-time.sh: Fix input of 08 and 09
printf was interpreting these as invalid octal numbers, they're decimal. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
05ce2cd0a6
commit
3a0df1bd4b
@ -25,8 +25,11 @@ get_date () {
|
||||
echo
|
||||
done
|
||||
|
||||
# Pad with zeroes to length of maximum value
|
||||
value="$(printf "%0${#max}u" "$value")"
|
||||
# Pad with zeroes to length of maximum value.
|
||||
# The "$((10#$value))" is needed to handle 08 and 09 correctly, which printf
|
||||
# would otherwise interpret as octal. This effectively strips the leading
|
||||
# zero by evaluating an arithmetic expression with the base set to 10.
|
||||
value="$(printf "%0${#max}u" "$((10#$value))")"
|
||||
}
|
||||
|
||||
enter_time_and_change()
|
||||
|
Loading…
Reference in New Issue
Block a user