mirror of
https://github.com/Lissy93/dotfiles.git
synced 2025-01-24 21:08:39 +01:00
Fixes formatting of welcome banner on MacOS
This commit is contained in:
parent
1ab193b238
commit
8ca0dc1e30
@ -16,11 +16,8 @@ function welcome() {
|
|||||||
COLOR_P="\033[1;36m"
|
COLOR_P="\033[1;36m"
|
||||||
COLOR_S="\033[0;36m"
|
COLOR_S="\033[0;36m"
|
||||||
|
|
||||||
# Format user's name
|
|
||||||
name=$(echo "$USER" | sed 's/.*/\u&/')
|
|
||||||
|
|
||||||
# Make welcome message
|
# Make welcome message
|
||||||
WELCOME_MSG="$greeting $name!"
|
WELCOME_MSG="$greeting $USER!"
|
||||||
|
|
||||||
# Print welcome message, using figlet & lolcat if availible
|
# Print welcome message, using figlet & lolcat if availible
|
||||||
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
|
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
|
||||||
@ -41,23 +38,21 @@ function welcome() {
|
|||||||
|
|
||||||
timeout=0.5
|
timeout=0.5
|
||||||
|
|
||||||
echo -e "\033[1;34mToday\n------"
|
echo "\033[1;34mToday\n------"
|
||||||
|
|
||||||
# Print date time
|
# Print date time
|
||||||
echo -e "$COLOR_S$(date '+🗓️ Date: %A, %B %d, %Y at %H:%M') \033[0m"
|
echo "$COLOR_S$(date '+🗓️ Date: %A, %B %d, %Y at %H:%M')"
|
||||||
|
|
||||||
# Print local weather
|
# Print local weather
|
||||||
echo -en $COLOR_S
|
|
||||||
curl -s -m $timeout "wttr.in?format=%cWeather:+%C+%t,+%p+%w"
|
curl -s -m $timeout "wttr.in?format=%cWeather:+%C+%t,+%p+%w"
|
||||||
echo -e "\033[0m"
|
echo -e "\033[0m"
|
||||||
|
|
||||||
# Print IP address
|
# Print IP address
|
||||||
|
if hash ip 2>/dev/null; then
|
||||||
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
|
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
|
||||||
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
|
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
|
||||||
echo -en "$COLOR_S🌐 IP: "
|
echo "${COLOR_S}🌐 IP: $(curl -s -m $timeout 'https://ipinfo.io/ip') (${ip_address} on ${ip_interface})\033[0m\n"
|
||||||
curl -s -m $timeout "https://ipinfo.io/ip"
|
fi
|
||||||
echo -en " (${ip_address} on ${ip_interface})\033[0m\n"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if file is being run directly or sourced
|
# Determine if file is being run directly or sourced
|
||||||
|
Loading…
Reference in New Issue
Block a user