env/setup

20 lines
554 B
Bash

#!/bin/bash
#
# Detects the current shell (bash, zsh, ...) and adds, if necessary, a managed
# block to its configuration to source extra files on shell-start.
#
SHELL_CONFIG_PATH=""
if [[ -n $(echo $SHELL | grep zsh) ]]; then
SHELL_CONFIG_PATH="$HOME/.zshrc"
else
SHELL_CONFIG_PATH="$HOME/.bashrc"
fi
if [[ -z $(cat $SHELL_CONFIG_PATH | grep 'mcataford/env-managed-block') ]]; then
echo '# mcataford/env-managed-block:start
for f in ~/.env_goodies/source/*; do source $f; done
# mcataford/env-managed-block:end' >> $SHELL_CONFIG_PATH
fi