Permalink
Browse files

lots of updates for `install.sh` w00t

  • Loading branch information...
ipatch committed Jul 19, 2018
1 parent 4d4a540 commit 0845644586a98b11c10e204875a8da32ce4b52c6
Showing with 27 additions and 17 deletions.
  1. +27 βˆ’17 install.sh
@@ -47,36 +47,46 @@ Rst='\e[0m' # Reset text

# Regular High Intensity BoldHigh Intens
Bla='\e[0;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m';
Red='\e[0;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m';
Red='\e[0;31m'; # IRed='\e[0;91m'; BIRed='\e[1;91m';
Gre='\e[0;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m';
Yel='\e[0;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m';
Blu='\e[0;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m';
Pur='\e[0;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m';
Cya='\e[0;36m'; ICya='\e[0;96m'; BICya='\e[1;96m';
Whi='\e[0;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m';

blue=$(tput setaf 4)
normal=$(tput sgr0)

# NOTE: from the printf(1) man page, `%b` interprets a string with a `\`

printf "%bThis text is red%s""\\n" "$Red" "$normal"
printf "%sThis text is blue%s""\\n" "$blue" "$normal"
# printf "%bThis text is going to be purple." "\\n" "$Pur"

# Usage: `printf "${Blu}blue ${Red}red ${Rst}etc..."`
printf "%blue %red %etc..." "$Blu" "$Red" "$Rst""\\n"
printf "%Hello World" "$Gre" "$Rst""\\n"
printf "%italics" "$Itl" "$Rst" "\\n"
printf "% %italics" "$Itl" "$Red" "$Rst" "\\n"

printf "% % BOLD + italics" "$Itl" "$Bld" "$Rst" "\\n"
printf "% %bold + italics" "$Bld" "$Itl" "$Rst" "\\n"
printf "% %This text should bold + blue" "$Bld" "$Blu" "$Rst" "\\n"
printf "%bblue %bred %betc...""\\n" "$Blu" "$Red" "$Rst"
printf "%bHello World""\\n" "$Gre" "$Rst"
printf "%bitalics""\\n" "$Itl" "$Rst"
# printf "%b %bitalics""\\n" "$Itl" "$Red" "$Rst"

printf "%bBOLD + italics""\\n" "$Bld" "$Itl" "$Rst"
printf "%bbold + italics""\\n" "$Bld" "$Itl" "$Rst"
printf "%bThis text should bold + blue""\\n" "$Bld" "$Blu" "$Rst"
# retrieve πŸ• running Operating System
if test -x /usr/bin/uname
then
dots_os="$(/usr/bin/uname)"
printf "Your %OS appears to be %, ie. %macOS" "$BIWhi" "$Rst" "$dots_os" "$BIWhi" "$Rst" "\\n"
printf "Your %bOS%b appears to be %s, ie. %bmacOS%b""\\n" "$BIWhi" "$Rst" "$dots_os" "$BIWhi" "$Rst"
# ask $USER if the above is correct?
printf "Im going to test the color %Green" "$Gre" "$Rst" "\\n"
read -r "Is your OS macOS (${Gre}y${Rst}/${Red}n${Rst})?" choice < /dev/tty
printf "Im going to test the color %bGreen%b""\\n" "$Gre" "$Rst"
printf "Is your OS, macOS (%by%b/%bn%b)?""\\n" "$Gre" "$Rst" "$Red" "$Rst"
read -r choice < /dev/tty
case "$choice" in
y|Y ) printf "πŸ‘Œ %Okay, lets continue...""\\n" "$Gre";;
n|N ) printf "%Well πŸ’© thats embarrassing'\\n'...and we cant continue.""\\n" "$Red";;
y|Y ) printf "πŸ‘Œ %bOkay, lets continue...%b""\\n" "$Gre" "$Rst";;
n|N ) printf "%bWell πŸ’© thats embarrassing'\\n'...and we cant continue.%b""\\n" "$Red" "$Rst";;
# TODO: add color for 'y' and 'n' if possible
*) printf "%You gotta mash %y %or %n""\\n" "$Rst" "$Gre" "$Rst" "$Red"
*) printf "You gotta mash %by%b or %bn%b""\\n" "$Gre" "$Rst" "$Red" "$Rst"

esac
elif test -x /bin/uname
@@ -102,7 +112,7 @@ if test -x /usr/local/bin/bash
then
printf "found /usr/local/bin/bash"
dots_bash_bin="/usr/local/bin/bash"
printf "% =" "$dots_bash_bin"
printf "%s =" "$dots_bash_bin"
elif test -x /usr/bin/bash
then
echo "found /usr/bin/bash"
@@ -111,7 +121,7 @@ else
echo "404 bash not found"
fi

printf "%" "$dots_bash_bin"
printf "%s" "$dots_bash_bin"

# > When setting the output of a command to a variable make sure to enclose `$(command)` within double quotes
# Ex. `"$(type -a bash)"

0 comments on commit 0845644

Please sign in to comment.