#!/bin/sh error_exit() { echo "Failed to add \"aquote show\"" exit 1 } detect_shell() { case "$SHELL" in */bash ) echo "bash";; */zsh ) echo "zsh";; */fish ) echo "fish";; esac } add_for_bash() { echo "Adding \"aquote show\" to \"$HOME/.bashrc\"" } add_for_zsh() { echo "Adding \"aquote show\" to \"$HOME/.zshrc\"" } add_for_fish() { echo "Adding \"aquote show\" to \"$HOME/.config/fish/functions/fish_greeting.fish\"" } add_shell_greeting() { case $(detect_shell) in bash ) add_for_bash;; zsh ) add_for_zsh;; fish ) add_for_fish;; esac } case $(detect_shell) in bash ) prompt_msg='Add "aquote show" to .bashrc? [Y/n] ';; zsh ) prompt_msg='Add "aquote show" to .zshrc? [Y/n] ';; fish ) prompt_msg='Add "aquote show" to fish_greeting.fish? [Y/n] ';; esac if [ -n "$prompt_msg" ]; then while true; do read -p "$prompt_msg" yn case $yn in [Yy]* ) add_shell_greeting; break;; [Nn]* ) echo '"aquote show" is not added'; break;; ?* ) echo "Please answer yes or no";; * ) add_shell_greeting; break;; esac done else echo "Unable to automatically add \"aquote show\" for your shell, please add it manually" fi