Last active
February 5, 2018 10:34
-
-
Save a-maumau/d3f603e240d4553c280cadac48085c50 to your computer and use it in GitHub Desktop.
for my convenience
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# for insurance to avoid catastrophe | |
set -Ceu | |
RC_FILE=0 | |
# find default shell rc file of major shells | |
if [[ $(echo $SHELL | grep bash) ]]; then | |
RC_FILE=$HOME/.bashrc | |
elif [[ $(echo $SHELL | grep zsh) ]]; then | |
RC_FILE=$HOME/.zshrc | |
elif [[ $(echo $SHELL | grep csh) ]]; then | |
RC_FILE=$HOME/.cshrc | |
elif [[ $(echo $SHELL | grep ksh) ]]; then | |
RC_FILE=$HOME/.kshrc | |
elif [[ $(echo $SHELL | grep tcsh) ]]; then | |
RC_FILE=$HOME/.tcshrc | |
elif [[ $(echo $SHELL | grep ash) ]]; then | |
RC_FILE=$HOME/.ashrc | |
elif [[ $(echo $SHELL | grep sh) ]]; then | |
RC_FILE=$HOME/.profile | |
else | |
echo "Non-standard shell $SHELL detected. sorry" | |
fi | |
# check if file exist by -f | |
if [ -f "$RC_FILE" ]; then | |
echo "$RC_FILE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment