Created
August 28, 2024 00:23
-
-
Save realyukii/d29fc029fc0882a5e33cf452f09285ef to your computer and use it in GitHub Desktop.
expand day name on cal unix command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
cal | python3 -c " | |
import sys | |
lines = sys.stdin.read().splitlines() | |
# Replace weekday abbreviations with full names, ensuring consistent spacing | |
header = lines[1] | |
header = header.replace('Su', 'Sunday ').replace('Mo', 'Monday ').replace('Tu', 'Tuesday ').replace('We', 'Wednesday').replace('Th', 'Thursday ').replace('Fr', 'Friday ').replace('Sa', 'Saturday ') | |
# Print the month/year and the modified header | |
print(lines[0]) | |
print(header) | |
# Format and print each line of the calendar | |
for line in lines[2:]: | |
formatted_line = ' '.join(day.ljust(9) if day.isdigit() else day for day in line.split()) | |
print(formatted_line) | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment