Updated dotfiles-zsh
Added random quote lines directly to .zshrc, updated README, commented create-links and removed separate quote script
This commit is contained in:
21
.zshrc
21
.zshrc
@@ -33,7 +33,26 @@ setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording en
|
||||
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
|
||||
setopt HIST_BEEP # Beep when accessing nonexistent history.
|
||||
|
||||
$HOME/dotfiles-zsh/get-quote.sh
|
||||
# Display Random Quote
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
QUOTE=$(curl -s https://files.planethawleywood.com/quotes.txt)
|
||||
if [ -n "$QUOTE" ]; then
|
||||
if command -v shuf >/dev/null 2>&1; then
|
||||
QUOTE=$(echo "$QUOTE" | shuf -n 1)
|
||||
fi
|
||||
if command -v cowsay >/dev/null 2>&1; then
|
||||
if command -v lolcat >/dev/null 2>&1; then
|
||||
echo "$QUOTE" | cowsay -f tux | lolcat
|
||||
else
|
||||
echo "$QUOTE" | cowsay -f tux
|
||||
fi
|
||||
elif command -v lolcat >/dev/null 2>&1; then
|
||||
echo "$QUOTE" | lolcat
|
||||
else
|
||||
echo "$QUOTE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Instant Prompt Preamble
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
Just a place to track my ZSH configs
|
||||
|
||||
Including `.zshrc`, `.fzf.zsh` and settings for [oh-my-zsh ](https://github.com/robbyrussell/oh-my-zsh) (required)
|
||||
|
||||
Includes `.zshrc.original` as a working reference since I've changed mine so much.
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
[[ -L $HOME/.zshrc ]] && unlink $HOME/.zshrc
|
||||
[[ -L $HOME/.fzf.zsh ]] && unlink $HOME/.fzf.zsh
|
||||
|
||||
# Create symlinks to files in repository
|
||||
ln -s $PWD/.zshrc $HOME/.zshrc
|
||||
ln -s $PWD/.fzf.zsh $HOME/.fzf.zsh
|
||||
|
||||
42
get-quote.sh
42
get-quote.sh
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#===============================================================================
|
||||
#
|
||||
# FILE:
|
||||
# USAGE:
|
||||
# DESCRIPTION:
|
||||
# REQUIREMENTS:
|
||||
# NOTES:
|
||||
# AUTHOR: C Hawley
|
||||
# CREATED:
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
# URL of the text file
|
||||
TEXT_FILE_URL="https://files.planethawleywood.com/quotes.txt"
|
||||
|
||||
# Download the text file using curl and store it in a temporary file
|
||||
temp_file=$(mktemp)
|
||||
curl -s "$TEXT_FILE_URL" > "$temp_file"
|
||||
|
||||
# Count the number of lines in the file
|
||||
num_lines=$(wc -l < "$temp_file")
|
||||
|
||||
# Generate a random line number
|
||||
random_line=$(( (RANDOM % num_lines) + 1))
|
||||
|
||||
# Display the random line
|
||||
quote=$(sed -n "${random_line}p" "$temp_file")
|
||||
|
||||
# cowsay and lolcat if available
|
||||
if [[ $(command -v cowsay) ]]; then
|
||||
if [[ $(command -v lolcat) ]]; then
|
||||
cowsay -f tux "${quote}" | lolcat
|
||||
else
|
||||
cowsay -f tux "${quote}"
|
||||
fi
|
||||
else
|
||||
echo "${quote}"
|
||||
fi
|
||||
|
||||
# remove temp file
|
||||
rm $temp_file
|
||||
Reference in New Issue
Block a user