fixed extra whitespace from stripping html output

This commit is contained in:
pyr0ball 2023-05-24 19:45:56 -07:00
parent 3cf34b262a
commit 9a685ad303

View file

@ -3,6 +3,7 @@
# Bash expansions to get the name and location of this script when run # Bash expansions to get the name and location of this script when run
scriptname="${BASH_SOURCE[0]##*/}" scriptname="${BASH_SOURCE[0]##*/}"
script_title="${grn}Go${blu}la${red}n${ylw}g${dfl}"
rundir="${BASH_SOURCE[0]%/*}" rundir="${BASH_SOURCE[0]%/*}"
sys_arch=$(uname -m) sys_arch=$(uname -m)
@ -32,8 +33,8 @@ pip_packages=()
repo_packages=() repo_packages=()
codedog_bashrc="# CodeDog system path setup codedog_bashrc="# Golang system path setup
export PATH=\"\$PATH:\$HOME/devl/CodeDog\" export PATH=\"\$PATH:/usr/local/go/bin/\"
" "
strip-html-tags() { strip-html-tags() {
@ -94,6 +95,7 @@ dry-run-report(){
install(){ install(){
local _golang_html=$(curl -ks "https://go.dev/dl/" | grep linux-amd64 | grep 1.19 | head -n 1) local _golang_html=$(curl -ks "https://go.dev/dl/" | grep linux-amd64 | grep 1.19 | head -n 1)
local golang_current=$(strip-html-tags "$_golang_html") local golang_current=$(strip-html-tags "$_golang_html")
golang_current=$(echo "$golang_current" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
export tmp_dir=`mktemp -d /tmp/selfextract.XXXXXX` export tmp_dir=`mktemp -d /tmp/selfextract.XXXXXX`
run wget "https://go.dev/dl/${golang_current}" -O $tmp_dir/$golang_current run wget "https://go.dev/dl/${golang_current}" -O $tmp_dir/$golang_current
run sudo rm -rf /usr/local/go run sudo rm -rf /usr/local/go
@ -128,13 +130,13 @@ usage(){
case $1 in case $1 in
-i | --install) -i | --install)
install && success " [${lbl}Slip${gry}Stream ${lyl}Installed${dfl}]" install && success " [${script_title} ${lyl}Installed${dfl}]"
;; ;;
-r | --remove) -r | --remove)
remove && success " [${lbl}Slip${gry}Stream ${lyl}Removed${dfl}]" remove && success " [${script_title} ${lyl}Removed${dfl}]"
;; ;;
-d | --dependencies) -d | --dependencies)
install-deps && success "${lbl}Slip${gry}Stream ${dfl} Dependencies installed!" install-deps && success "${script_title} ${dfl} Dependencies installed!"
;; ;;
-D | --dry-run) -D | --dry-run)
export dry_run=true export dry_run=true
@ -142,18 +144,18 @@ case $1 in
dry-run-report dry-run-report
usage usage
unset dry_run unset dry_run
success "${lbl}Slip${gry}Stream ${lyl}Installer Dry-Run Complete!${dfl}" success "${script_title} ${lyl}Installer Dry-Run Complete!${dfl}"
;; ;;
-u | --update) -u | --update)
export update_run=true export update_run=true
update && unset update_run && success " [${lbl}Slip${gry}Stream ${lyl}Updated${dfl}]" update && unset update_run && success " [${script_title} ${lyl}Updated${dfl}]"
;; ;;
-f | --force) -f | --force)
remove-arbitrary remove-arbitrary
install && success " [${lbl}Slip${blu}Stream ${lyl}Installed${dfl}]" install && success " [${script_title} ${lyl}Installed${dfl}]"
;; ;;
-F | --force-remove) -F | --force-remove)
remove-arbitrary && success " [${lbl}Slip${gry}Stream ${lyl}Force-Removed${dfl}]" remove-arbitrary && success " [${script_title} ${lyl}Force-Removed${dfl}]"
;; ;;
-h | --help) -h | --help)
usage usage