Last active
February 12, 2023 18:56
-
-
Save andrewhenke/f4243b7974fc5dcce948df67c1d6f914 to your computer and use it in GitHub Desktop.
Script to auto-import and configure the bash aliases given at https://andrewhenke.com/bash-aliases-to-make-your-life-easier/
This file contains 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
FILE=$HOME/.bash_aliases | |
if [ -f "$FILE" ]; then | |
echo "Bash Aliases file detected - backing up" | |
mv $HOME/.bash_aliases $HOME/.bash_aliases.bak | |
else | |
echo "Bash Aliases file does not exist, proceeding" | |
fi | |
if grep -Fxq "if [ -f ~/.bash_aliases ]; then" $HOME/.bashrc; | |
then | |
echo "Bash Alias file configuration present - adding aliases" | |
wget -q "https://gist.githubusercontent.com/andrewhenke/0c1ff2858e776ce10fca9cb5d65828e8/raw/e7450664ca4e754d7b7ff10880dace96d5c2cdfc/.bash_aliases" | |
source $HOME/.bashrc | |
source $HOME/.bash_aliases | |
echo "Aliases Added" | |
else | |
echo "Bash Alias file configuration not found, adding support now." | |
echo " " >> $HOME/.bashrc | |
echo "#Adding support for the .bash_aliases file" >> $HOME/.bashrc | |
echo 'if [ -f ~/.bash_aliases ]; then' >> $HOME/.bashrc | |
echo ' . ~/.bash_aliases' >> $HOME/.bashrc | |
echo 'fi' >> $HOME/.bashrc | |
source $HOME/.bashrc | |
echo "Support added - creating aliases" | |
wget -q "https://gist.githubusercontent.com/andrewhenke/0c1ff2858e776ce10fca9cb5d65828e8/raw/e7450664ca4e754d7b7ff10880dace96d5c2cdfc/.bash_aliases" | |
source $HOME/.bashrc | |
# source $HOME/.bash_aliases | |
echo "Aliases Created" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment