🔧 Updated btime script, more efficient
This commit is contained in:
parent
49085c5bda
commit
bd038049c0
2 changed files with 14 additions and 1 deletions
14
scripts/btime
Executable file
14
scripts/btime
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
main() {
|
||||
hour=$(date +%H)
|
||||
if ((hour >= 12 && hour < 16)); then
|
||||
printf "%s AM\n" "$(date '+%I:%M:%S')"
|
||||
elif ((hour >= 16 || hour <= 23)); then
|
||||
printf "%s PM\n" "$(date '+%I:%M:%S')"
|
||||
else
|
||||
echo "Invalid hour. Please check your system clock."
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
Loading…
Add table
Add a link
Reference in a new issue