-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bash_motd
More file actions
64 lines (58 loc) · 1.39 KB
/
.bash_motd
File metadata and controls
64 lines (58 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Get user's full name
# name=$(getent passwd $USER | cut -d ':' -f 5) # Linux
name=$(id -F) # Mac
name=${name//','}
# Prepare list of greetings according to local time, as flavor text
hour=$(date +%k)
if [[ $hour -lt 6 ]]; then
greet=(
"Greetings, ${name}, friend of the night."
)
elif [[ $hour -lt 12 ]]; then
greet=(
"Good morning, ${name}."
"Top of the morning to you, ${name}."
)
elif [[ $hour -lt 19 ]]; then
greet=(
"Good afternoon, ${name}."
)
else
greet=(
"Good evening, ${name}."
)
fi
greet+=(
"Hello, ${name}."
"Yip hi ${name} :3"
"H-hewwo? uwu"
"OwO"
"uwu"
)
# Randomly choose a greeting
index=$[$RANDOM % ${#greet[@]}]
greeting=${greet[$index]}
# MOTD text
# motd_long="$greeting, ${name}.\n
# \n
# Today's $(date +"%A"),\n
# $(date +"%F %T %z (%Z)")\n
# \n
# $(hostname): up $(uptime | cut -d 'p' -f 2)\n
# "
motd_short="${greeting}\n
\n
${HOSTNAME}: up $(uptime | cut -d 'p' -f 2)\n
"
# Cowfile selection
cow=tux
if [[ -f /usr/share/cowsay/cows/rayting.cow ]] || [[ -f /usr/share/cowsay/rayting.cow ]]; then
cow=rayting
elif [[ -r ~/code/foxsay/rayting.cow ]]; then
cow=~/code/foxsay/rayting.cow
fi
(echo -e $motd_short; fortune) | cowsay -nf $cow
# (echo -e $motd_short; fortune -c linux linuxcookie computers miscellaneous hugs) | cowsay -nf $cow
# | lolcat -p 9 -F .3
printf "\n"