Skip to content
Browse files

Added color output

  • Loading branch information...
1 parent f5a5c06 commit 616b29ef6d90d884534d4dce44e129737d2403c9 @zachwill committed May 17, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 link_files.sh
View
15 link_files.sh
@@ -5,14 +5,24 @@
# Usage:
# bash link_files.sh
+# Colors...
+GREEN='\033[32m'
+RED='\033[31m'
+BLUE='\033[34m'
+NC='\033[0m' # No Color
+
+# Output...
+DONE="${GREEN}Done${NC}"
+NOT_LINK="${RED}File not linked${NC}"
+
link_file() { ln -s $PWD/$file $HOME/$file ; return ; }
rm_and_link() { rm $HOME/$file && link_file ; return ; }
prompt_deletion() {
- read -n1 -p "Delete $HOME/$file and link new one? (y/n) " ;
+ read -n1 -p "Delete ~/$file and link new one? (y/n) " ;
printf "\n" ; # Blank newline
- [[ $REPLY == [yY] ]] && rm_and_link && echo Done || echo File not linked ;
+ [[ $REPLY == [yY] ]] && rm_and_link && echo -e $DONE || echo -e $NOT_LINK ;
}
for file in $(ls -a | grep ^\\.[a-z] | grep -v .git$)
@@ -24,3 +34,4 @@ do
link_file
fi
done
+echo -e "\n${BLUE}Returning to shell...${NC}\n"

0 comments on commit 616b29e

Please sign in to comment.
Something went wrong with that request. Please try again.