Skip to content

Instantly share code, notes, and snippets.

@hvmonteiro
Last active March 29, 2020 19:57
Show Gist options
  • Save hvmonteiro/24dcc24a678047f2fa193bc5c7dc7a38 to your computer and use it in GitHub Desktop.
Save hvmonteiro/24dcc24a678047f2fa193bc5c7dc7a38 to your computer and use it in GitHub Desktop.
Setup a user console in Linux
#!/bin/bash
#
# Description: This script will setup a customized user console in Linux
# based on my gists (https://gist.github.com/hvmonteiro)
# - .bashrc
# - .jshintrc
# - .LS_COLORS
# - .lessfilter
# - .config/terminator/config
# - .ssh/config
# - .screenrc
#
#
_OLDPWD="$OLDPWD"
cd "$HOME"
FILENAME="~/.bashrc"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.github.com/hvmonteiro/118a04718a2a43aa317dbf0e662826b2/raw/c99890d5f0ed5de354eb09a9ca64ef0a844bc9b9/.bashrc -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.jshintrc"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.githubusercontent.com/hvmonteiro/e22f63beef8267a9a60e2523ec404cf5/raw/b10865f7b4ac7e2fabfe1c87811238c4376df8b7/.jshintrc -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.LS_COLORS"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.githubusercontent.com/hvmonteiro/a79e8d5ef269b30410bc7b8a80ccd1ce/raw/7996ce2bdd56173b6bb5ff89bb8e7dfefa0df6ad/.LS_COLORS -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.lessfilter"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.github.com/hvmonteiro/118a04718a2a43aa317dbf0e662826b2/raw/38d9e1dfad6925f4bcc13eaf2bdb3c57bb287fb4/.lessfilter -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.vimrc"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.githubusercontent.com/hvmonteiro/f120dc0e57dbcf074a1d9bdab51316b1/raw/f199788c746df835bceaae7c003fc00022d5ab47/.vimrc -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.vim/bundle/Vundle.vim"
echo "Setup Vim plugin: Vundle..."
[ -d "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
git clone https://github.com/VundleVim/Vundle.vim.git "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
vim +PluginInstall +qall
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.config/terminator/config"
echo "Setup $FILENAME ..."
[ -f "~/.config/terminator" ] && mkdir -p ~/.config/terminator
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.github.com/hvmonteiro/b3c7339254e99c403bbab67930d622b1/raw/1065dc6670dedb35f63b4f72a5878cc09e4311ea/config -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.ssh/config"
echo "Setup $FILENAME ..."
[ -f "~/.ssh/config" ] && mv -f "$FILENAME" "$FILENAME".old
wget -q https://gist.github.com/hvmonteiro/135837ade479a025e822c321d4a305b2/raw/a2ea3ea0a778cb9b05a894d80e2bea2c87c65222/ssh_config -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
FILENAME="~/.screenrc"
echo "Setup $FILENAME ..."
[ -f "$FILENAME" ] && mv -f "$FILENAME" "$FILENAME".old
https://gist.github.com/hvmonteiro/e1cb0bb022cab7b6ed621d293e648dde/raw/58611ab3cfcf232fc9fa5fe7112c5de2ce39772f/.screenrc -O "$FILENAME"
[ $? -ne 0 ] && read -p "An error as ocurred. Check previous output for more info. (Enter to continue, CTRL+C to exit)"
which shellcheck || echo "Warning: 'vim' was configured to use shellcheck, but no shellcheck was found in yout \$PATH."
cd "$_OLDPWD"
exit 0
@hvmonteiro
Copy link
Author

hvmonteiro commented Jan 25, 2018

How to use:
user$ wget -q <raw url> -O - | sh

Thats it!

P.S. To get the latest press "Raw" button on the top left text window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment