initial version of .bash_profile and .bash_logout files incorporating fortune, cowsay...
authorThomas Leavitt <thomas@thomasleavitt.org>
Sun, 2 Dec 2018 09:31:02 +0000 (01:31 -0800)
committerThomas Leavitt <thomas@thomasleavitt.org>
Sun, 2 Dec 2018 09:31:02 +0000 (01:31 -0800)
.bash_logout [new file with mode: 0644]
.bash_profile [new file with mode: 0644]

diff --git a/.bash_logout b/.bash_logout
new file mode 100644 (file)
index 0000000..7db7200
--- /dev/null
@@ -0,0 +1,25 @@
+export COWPATH="/usr/local/git/cowfiles:/usr/local/git/cowsay-files/cows:/usr/local/share/localcows:/usr/local/share/cows"
+
+function lolcatcowsayfortune {
+
+    # randomly pick between cowsay and cowthink
+    declare -a cowsay_types=("cowsay" "cowthink")
+    cowsay_type=${cowsay_types[ $RANDOM % 2 ]}
+
+    # randomly pick an eye type
+    declare -a eye_types=("-b" "-d" "-g" "-p" "-s" "-t" "-w" "-y")
+    eye_type=${eye_types[ $RANDOM % 8 ]}
+
+    NUMOFCOWS=`cowsay -l | grep -v "Cow files in" | tail -n +2 | wc -w`
+    WHICHCOW=$((RANDOM%$NUMOFCOWS+1))
+    THISCOW=`cowsay -l | tail -n +2 | sed -e 's/\ /\'$'\n/g' | sed $WHICHCOW'q;d'`
+
+    #echo "Selected cow: ${THISCOW}, from ${WHICHCOW}"
+    fortune -s | $cowsay_type $eye_type -f $THISCOW -n | lolcat
+}
+
+# fortune, with cowsay and random cows, and lolcat; here instead of .bashrc 
+# to prevent remote eommands from failing due to output being generated
+if [ -e /usr/local/share/cows ] &&  [ -x /usr/local/bin/cowsay ] && [ -x /usr/local/bin/fortune ] && [ -x /usr/local/bin/lolcat ]; then
+    lolcatcowsayfortune
+fi
diff --git a/.bash_profile b/.bash_profile
new file mode 100644 (file)
index 0000000..de83538
--- /dev/null
@@ -0,0 +1,27 @@
+[[ -s ~/.bashrc ]] && source ~/.bashrc
+
+export COWPATH="/usr/local/git/cowfiles:/usr/local/git/cowsay-files/cows:/usr/local/share/localcows:/usr/local/share/cows"
+
+function lolcatcowsayfortune {
+
+    # randomly pick between cowsay and cowthink
+    declare -a cowsay_types=("cowsay" "cowthink")
+    cowsay_type=${cowsay_types[ $RANDOM % 2 ]}
+
+    # randomly pick an eye type
+    declare -a eye_types=("-b" "-d" "-g" "-p" "-s" "-t" "-w" "-y")
+    eye_type=${eye_types[ $RANDOM % 8 ]}
+
+    NUMOFCOWS=`cowsay -l | grep -v "Cow files in" | tail -n +2 | wc -w`
+    WHICHCOW=$((RANDOM%$NUMOFCOWS+1))
+    THISCOW=`cowsay -l | tail -n +2 | sed -e 's/\ /\'$'\n/g' | sed $WHICHCOW'q;d'`
+
+    #echo "Selected cow: ${THISCOW}, from ${WHICHCOW}"
+    fortune -s | $cowsay_type $eye_type -f $THISCOW -n | lolcat
+}
+
+# fortune, with cowsay and random cows, and lolcat; here instead of .bashrc 
+# to prevent remote eommands from failing due to output being generated
+if [ -e /usr/local/share/cows ] &&  [ -x /usr/local/bin/cowsay ] && [ -x /usr/local/bin/fortune ] && [ -x /usr/local/bin/lolcat ]; then
+    lolcatcowsayfortune
+fi