"Updates"
This commit is contained in:
@@ -103,7 +103,7 @@ sudo vim ~/local/bin/now
|
||||
#!/bin/bash
|
||||
|
||||
# NAME: now
|
||||
# PATH: $HOME/.local/bin
|
||||
# PATH: $HOME/bin
|
||||
# DESC: Display current weather, calendar and time
|
||||
# CALL: Called from terminal or ~/.bashrc
|
||||
# DATE: Apr 6, 2017. Modified: Mar 30, 2018.
|
||||
@@ -120,10 +120,7 @@ TimeColumn=61 # Default is 49 for " " " " 61 " " " "
|
||||
# Current weather, already in color so no need to override
|
||||
echo " "
|
||||
echo " "
|
||||
# Replace Edmonton with your city name, GPS, etc. See: curl wttr.in/:help
|
||||
curl wttr.in/Rennes?0 --silent --max-time 3
|
||||
# Timeout #. Increase for slow connection---^
|
||||
|
||||
echo " "
|
||||
echo " " # Pad with blank lines for calendar & time to fit
|
||||
|
||||
@@ -134,8 +131,8 @@ echo " " # Pad with blank lines for calendar & time to fit
|
||||
# 36=cyan, 37=white
|
||||
|
||||
tput sc # Save cursor position.
|
||||
# Move up 9 lines
|
||||
while [ $((++i)) -lt 10 ]; do tput cuu1; done
|
||||
# Move up 10 lines
|
||||
while [ $((++i)) -lt 11 ]; do tput cuu1; done
|
||||
|
||||
# Depending on length of your city name and country name you will:
|
||||
# 1. Comment out next three lines of code. Uncomment fourth code line.
|
||||
@@ -149,7 +146,7 @@ printf " " # Blank out ", country" with x spaces
|
||||
|
||||
|
||||
# -h needed to turn off formating: https://askubuntu.com/questions/1013954/bash-substring-stringoffsetlength-error/1013960#1013960
|
||||
cal -h > /tmp/terminal
|
||||
cal > ~/tmp/terminal
|
||||
|
||||
CalLineCnt=1
|
||||
Today=$(date +"%d")
|
||||
@@ -181,7 +178,7 @@ while IFS= read -r Cal; do
|
||||
tput cud1 # Down one line
|
||||
tput cuf $DateColumn # Move 27 columns right
|
||||
CalLineCnt=$((++CalLineCnt))
|
||||
done < /tmp/terminal
|
||||
done < ~/tmp/terminal
|
||||
|
||||
printf "\033[00m" # color -- bright white (default)
|
||||
echo ""
|
||||
@@ -199,13 +196,13 @@ tput cuf $TimeColumn # Move 49 columns right
|
||||
# Do we have the toilet package?
|
||||
if hash toilet 2>/dev/null; then
|
||||
echo " "$(date +"%I:%M %P")" " | \
|
||||
toilet -f future --filter border > /tmp/terminal
|
||||
toilet -f future --filter border > ~/tmp/terminal
|
||||
# Do we have the figlet package?
|
||||
elif hash figlet 2>/dev/null; then
|
||||
echo $(date +"%I:%M %P") | figlet > /tmp/terminal
|
||||
echo $(date +"%I:%M %P") | figlet > ~/tmp/terminal
|
||||
# else use standard font
|
||||
else
|
||||
echo $(date +"%I:%M %P") > /tmp/terminal
|
||||
echo $(date +"%I:%M %P") > ~/tmp/terminal
|
||||
fi
|
||||
|
||||
while IFS= read -r Time; do
|
||||
@@ -213,7 +210,7 @@ while IFS= read -r Time; do
|
||||
printf "$Time"
|
||||
tput cud1 # Up one line
|
||||
tput cuf $TimeColumn # Move 49 columns right
|
||||
done < /tmp/terminal
|
||||
done < ~/tmp/terminal
|
||||
|
||||
tput rc # Restore saved cursor position.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user