File: hello_timed

package info (click to toggle)
bash-unit 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,304 kB
  • sloc: sh: 1,134; makefile: 10
file content (17 lines) | stat: -rwxr-xr-x 272 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

declare -F current_hour >/dev/null || current_hour() {
  date +%H
}

if (( "$(current_hour)" < 11 ))
then
  echo "Good morning World!"
else
  if (( "$(current_hour)" > 17 ))
  then
    echo "Good evening World!"
  else
    echo "Hello World!"
  fi
fi