Permalink
Browse files

update `install/prompt.sh` and `install.sh`

  • Loading branch information...
ipatch committed Jul 19, 2018
1 parent 2c93ca9 commit 4d4a54003668a6c3b3fd12d0b92347985d2b04e1
Showing with 22 additions and 24 deletions.
  1. +21 βˆ’23 install.sh
  2. +1 βˆ’1 install/prompt.sh
@@ -56,53 +56,53 @@ Cya='\e[0;36m'; ICya='\e[0;96m'; BICya='\e[1;96m';
Whi='\e[0;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m';

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

printf "${Itl}${Bld}BOLD + italics${Rst}\n"
printf "${Bld}${Itl}bold ++ italics${Rst}\n"
printf "${Bld}${Blu}This text should bold + blue${Rst}\n"
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"
# retrieve πŸ• running Operating System
if test -x /usr/bin/uname
then
dots_os="$(/usr/bin/uname)"
echo "Your ${BWhi}OS${RCol} appears to be $dots_os, ie. ${BWhi}macOS${RCol}"
printf "Your %OS appears to be %, ie. %macOS" "$BIWhi" "$Rst" "$dots_os" "$BIWhi" "$Rst" "\\n"
# ask $USER if the above is correct?
read -p "I'm going to test the color ${Gre}Green"
read -p "Is your OS macOS (${Gre}y${CRol}/${Red}n${CRol})?" choice
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
case "$choice" in
y|Y ) printf "\nπŸ‘Œ ${Gre}Okay, let\'s continue...\n";;
n|N ) printf "\n${Red}Well πŸ’© that\'s embarrassing πŸ™ˆ\n...and we can\'t continue.\n";;
y|Y ) printf "πŸ‘Œ %Okay, lets continue...""\\n" "$Gre";;
n|N ) printf "%Well πŸ’© thats embarrassing'\\n'...and we cant continue.""\\n" "$Red";;
# TODO: add color for 'y' and 'n' if possible
*) echo "\n${RCol}You gotta mash ${Gre}y ${CRol}or ${Red}n'\n"
*) printf "%You gotta mash %y %or %n""\\n" "$Rst" "$Gre" "$Rst" "$Red"

esac
elif test -x /bin/uname
then
dots_os="$(/bin/uname)"
echo "Your OS appears to be $dots_os"
# ask $USER if the above is correct?
read -p "Is your OS Linux (y/n)?" choice
read -r "Is your OS Linux (y/n)?" choice < /dev/tty
case "$choice" in
y|Y ) printf "πŸ‘Œ Okay, wtf let\'s \ncontinue...\n";;
n|N ) printf "well πŸ’© that\'s embarrassing πŸ’©\nand we can't contine.\n";;
y|Y ) printf "πŸ‘Œ Okay, wtf lets '\\n' continue...""\\n";;
n|N ) printf "well πŸ’© that'\\''s embarrassing '\\n' and we can't continue.""\\n";;
# TODO: add color for 'y' and 'n' if possible
*) echo "you gotta mash 'y' or 'n'"
esac

else
# TODO: test this condition using a FreeBSD docker image
echo "Could not identify your OS 🀷"
printf "Could not identify your OS 🀷"
fi

# look for bash v2
if test -x /usr/local/bin/bash
then
echo "found /usr/local/bin/bash"
printf "found /usr/local/bin/bash"
dots_bash_bin="/usr/local/bin/bash"
echo "dots_bash_bin = $dots_bash_bin"
printf "% =" "$dots_bash_bin"
elif test -x /usr/bin/bash
then
echo "found /usr/bin/bash"
@@ -111,7 +111,7 @@ else
echo "404 bash not found"
fi

echo "$dots_bash_bin"
printf "%" "$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)"
@@ -141,5 +141,3 @@ echo "$dots_bash_bin"

# swith from /bin/sh to /usr/bin/env bash



@@ -61,7 +61,7 @@ echo Would you like to proceed? "(Y or N)"
# exit

echo "Prompting for yes or no"
read yesno < /dev/tty
read -r yesno < /dev/tty

if [ "$yesno" = "xy" ]; then
echo "yup"

0 comments on commit 4d4a540

Please sign in to comment.