2021-05-08 14:42:53 +00:00
|
|
|
#!/bin/bash
|
2020-03-23 00:42:02 +00:00
|
|
|
|
2022-11-04 17:37:25 +00:00
|
|
|
#
|
|
|
|
# Detects the current shell (bash, zsh, ...) and adds, if necessary, a managed
|
|
|
|
# block to its configuration to source extra files on shell-start.
|
|
|
|
#
|
|
|
|
|
2021-05-08 14:42:53 +00:00
|
|
|
SHELL_CONFIG_PATH=""
|
2020-03-23 00:42:02 +00:00
|
|
|
|
2021-05-08 14:42:53 +00:00
|
|
|
if [[ -n $(echo $SHELL | grep zsh) ]]; then
|
|
|
|
SHELL_CONFIG_PATH="$HOME/.zshrc"
|
|
|
|
else
|
|
|
|
SHELL_CONFIG_PATH="$HOME/.bashrc"
|
|
|
|
fi
|
2020-03-23 00:42:02 +00:00
|
|
|
|
2021-05-08 14:42:53 +00:00
|
|
|
if [[ -z $(cat $SHELL_CONFIG_PATH | grep 'mcataford/env-managed-block') ]]; then
|
|
|
|
echo '# mcataford/env-managed-block:start
|
2022-11-04 17:28:07 +00:00
|
|
|
for f in ~/.env_goodies/source/*; do source $f; done
|
2021-05-08 14:42:53 +00:00
|
|
|
# mcataford/env-managed-block:end' >> $SHELL_CONFIG_PATH
|
|
|
|
fi
|