14 lines
316 B
Bash
Executable file
14 lines
316 B
Bash
Executable file
#!/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
|