#!/bin/bash enc_arch="keys" arch="keys.tar.gz" function ask() { read -p "$1 (Y/n): " resp if [ -z "$resp" ]; then response_lc="y" # empty is Yes else response_lc=$(echo "$resp" | tr '[:upper:]' '[:lower:]') # case insensitive fi [ "$response_lc" = "y" ] } for file in ".vimrc" ".tmux.conf" ".bash_profile" ".gitconfig"; do if ask "Install ${file}?"; then ln -s "$(realpath "$file")" ~/${file} fi done for file in *; do if [ "$file" == "$enc_arch" ]; then if ask "Install keys?"; then gpg --output "$arch" --decrypt "$enc_arch" tar -xzvf "keys.tar.gz" -C ~ rm -rf keys.tar.gz fi fi done