33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# %-d strips the leading zero so "06" becomes "6" — needed for bracket matching below.
|
|
today=$(date +%-d)
|
|
# %u is ISO weekday: 1=Monday … 7=Sunday.
|
|
weekdaynum=$(date +%u)
|
|
weekday=""
|
|
# Map ISO weekday number to the two-letter abbreviation that `cal` prints in its header.
|
|
if [[ $weekdaynum -eq 1 ]]; then
|
|
weekday="Mo"
|
|
elif [[ $weekdaynum -eq 2 ]]; then
|
|
weekday="Tu"
|
|
elif [[ $weekdaynum -eq 3 ]]; then
|
|
weekday="We"
|
|
elif [[ $weekdaynum -eq 4 ]]; then
|
|
weekday="Th"
|
|
elif [[ $weekdaynum -eq 5 ]]; then
|
|
weekday="Fr"
|
|
elif [[ $weekdaynum -eq 6 ]]; then
|
|
weekday="Sa"
|
|
elif [[ $weekdaynum -eq 7 ]]; then
|
|
weekday="Su"
|
|
fi
|
|
|
|
echo ======================
|
|
date '+%A, %d.%m.%Y'
|
|
echo ======================
|
|
# -m: start week on Monday. `sed 's/^/ /'` indents every line for padding.
|
|
# The two substitutions wrap today's date number and the current weekday column
|
|
# in square brackets so Eww can highlight them via CSS class matching.
|
|
cal -m | sed -e 's/^/ /' | sed "s/ $today /[$today]/" | sed "s/ $weekday /[$weekday]/"
|
|
|
|
|