From 97f3e684eb6a74b4ce43bb11344f8a450ac55d30 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sun, 4 Dec 2011 14:18:06 -0500 Subject: [PATCH 1/3] Added root prompt and mysql alias For some reason, I couldn't get the prompt ($) to show as root (#) so I went ahead and added a conditional to do so. Also made the cyan embelishment red for extra emphasis. --- bash.bashrc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bash.bashrc b/bash.bashrc index 3407d3a..531f008 100755 --- a/bash.bashrc +++ b/bash.bashrc @@ -44,13 +44,21 @@ export D_CYAN="\[\033[2;36m\]" export D_WHITE="\[\033[2;37m\]" # Prompt -export PS1="\n$D_CYAN╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$D_CYAN╵┗ $D_WHITE\$ $RESET" +if [ `whoami` == "root" ]; +then + export PS1="\n$B_RED╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$B_RED╵┗ $D_WHITE# $RESET" +else + export PS1="\n$D_CYAN╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$D_CYAN╵┗ $D_WHITE\$ $RESET" +fi + export PS2="$D_WHITE> $RESET" # Aliases -alias ac="sudo apt-cache" -alias ag="sudo apt-get" +# apt-* +alias ac="sudo apt-cache" +alias ag="sudo apt-get" +# git alias ga="git add" alias gaa="git add $(git rev-parse --show-toplevel)" # Adds all new files from the project root alias gc="git commit" @@ -73,5 +81,7 @@ alias grr="git remote rm" alias grro="git remote rm origin" alias grm="git rm" alias gs="git status" +# mysql +alias msk="mysql scenekids" fortune From db9d80b96be441b4e300ef47442be5a721b0ac9a Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sun, 4 Dec 2011 14:39:42 -0500 Subject: [PATCH 2/3] Started building an install script --- install.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..22f7ae7 --- /dev/null +++ b/install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# TODO check if fortune-mod is installed and if not, install it + +# Clears out the old .bashrc +if [ -f ~/.bashrc ]; +then + rm ~/.bashrc +fi + +# Grabs the skeleton .bashrc +cp /etc/skel/.bashrc ~/.bashrc + +# Appends the custom .bashrc file +echo " +if [ -f `pwd`/bash.bashrc ] && ! shopt -oq posix; then + . `pwd`/bash.bashrc +fi" >> ~/.bashrc From 7a2f1c345b516def04f9c5c311bbfc404c35cd4f Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sun, 4 Dec 2011 14:45:40 -0500 Subject: [PATCH 3/3] Updated logic to check for root Also moved fortune into conditional as root doesn't have /usr/games in it's path... plus it seems redundant to issue a second fortune in the same terminal --- bash.bashrc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bash.bashrc b/bash.bashrc index 531f008..386ab40 100755 --- a/bash.bashrc +++ b/bash.bashrc @@ -44,11 +44,12 @@ export D_CYAN="\[\033[2;36m\]" export D_WHITE="\[\033[2;37m\]" # Prompt -if [ `whoami` == "root" ]; +if [[ $EUID -ne 0 ]]; then - export PS1="\n$B_RED╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$B_RED╵┗ $D_WHITE# $RESET" -else export PS1="\n$D_CYAN╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$D_CYAN╵┗ $D_WHITE\$ $RESET" + fortune +else + export PS1="\n$B_RED╷┏ $D_GREEN\t$RESET:$D_WHITE\u$RESET@$D_MAGENTA\h$RESET:$B_BLUE\w$YELLOW\$(__git_ps1)\n$B_RED╵┗ $D_WHITE# $RESET" fi export PS2="$D_WHITE> $RESET" @@ -83,5 +84,3 @@ alias grm="git rm" alias gs="git status" # mysql alias msk="mysql scenekids" - -fortune