@@ -48,7 +48,7 @@ prepare() {
4848 # FIXME doesn’t seem to work through `gum` prompts
4949 trap " echo; exit" INT
5050
51- if ! command -v tar > /dev/null 2>&1 ; then
51+ if ! command -v tar > /dev/null; then
5252 echo " tea: error: sorry. pls install tar :(" >&2
5353 fi
5454
@@ -94,12 +94,12 @@ prepare() {
9494 fi
9595
9696 if test $ZZ = ' gz' ; then
97- if command -v base64 > /dev/null 2>&1 ; then
97+ if command -v base64 > /dev/null; then
9898 BASE64_TARXZ=" /Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4AX/AFNdADMb7AG6cMNAaNMVK8FvZMaza8QKKTQY6wZ3kG/F814lHE9ruhkFO5DAG7XNamN7JMHavgmbbLacr72NaAzgGUXOstqUaGb6kbp7jrkF+3aQT12CAAB8Uikc1gG8RwABb4AMAAAAeGbHwbHEZ/sCAAAAAARZWg=="
9999 if echo " $BASE64_TARXZ " | base64 -d | tar Jtf - > /dev/null 2>&1 ; then
100100 ZZ=xz
101101 fi
102- elif command -v uudecode > /dev/null 2>&1 ; then
102+ elif command -v uudecode > /dev/null; then
103103 TMPFILE=$( mktemp)
104104 cat > " $TMPFILE " << -EOF
105105 begin 644 foo.tar.xz
@@ -125,7 +125,7 @@ prepare() {
125125
126126 if test -z " $TEA_DESTDIR " ; then
127127 # update existing installation if found
128- if command -v tea > /dev/null 2>&1 ; then
128+ if command -v tea > /dev/null; then
129129 set +e
130130 TEA_DESTDIR=" $( tea --prefix --silent) "
131131 if test $? -eq 0 -a -n " $TEA_DESTDIR " ; then
@@ -158,7 +158,7 @@ prepare() {
158158 esac
159159
160160 if test -z " $CURL " ; then
161- if command -v curl > /dev/null 2>&1 ; then
161+ if command -v curl > /dev/null; then
162162 CURL=" curl -Ssf"
163163 elif test -f " $TEA_DESTDIR /curl.se/v*/bin/curl" ; then
164164 CURL=" $TEA_DESTDIR /curl.se/v*/bin/curl -Ssf"
@@ -171,7 +171,7 @@ prepare() {
171171}
172172
173173get_gum () {
174- if command -v gum > /dev/null 2>&1 ; then
174+ if command -v gum > /dev/null; then
175175 TEA_GUM=gum
176176 elif test -n " $ALREADY_INSTALLED " ; then
177177 TEA_GUM=" tea --silent +charm.sh/gum gum"
@@ -354,7 +354,7 @@ check_path() {
354354 then
355355 mkdir -p /usr/local/bin
356356 ln -sf " $TEA_EXENAME " /usr/local/bin/tea
357- elif command -v sudo > /dev/null 2>&1
357+ elif command -v sudo > /dev/null
358358 then
359359 sudo --reset-timestamp
360360 sudo mkdir -p /usr/local/bin
@@ -367,7 +367,7 @@ check_path() {
367367 EoMD
368368 fi
369369
370- if ! command -v tea > /dev/null 2>&1
370+ if ! command -v tea > /dev/null
371371 then
372372
373373 echo # spacer
@@ -395,11 +395,20 @@ check_shell_magic() {
395395
396396 # foo knows I cannot tell you why $SHELL may be unset
397397 if test -z " $SHELL " ; then
398- if command -v finger > /dev/null 2>&1 ; then
398+ if test -z " $USER " ; then
399+ if ! command -v whoami > /dev/null; then
400+ SHELL=bash
401+ else
402+ USER=" $( whoami) "
403+ fi
404+ fi
405+ if test -n " $SHELL " ; then
406+ : # noop: set above
407+ elif command -v finger > /dev/null; then
399408 SHELL=" $( finger " $USER " | grep Shell | cut -d: -f3 | tr -d ' ' ) "
400- elif command -v getent > /dev/null 2>&1 ; then
409+ elif command -v getent > /dev/null; then
401410 SHELL=" $( getent passwd " $USER " ) "
402- elif command -v id > /dev/null 2>&1 ; then
411+ elif command -v id > /dev/null; then
403412 SHELL=" $( id -P | cut -d ' :' -f 10) "
404413 # Try to fall back with some level of normalcy
405414 elif test " $( uname) " == " Darwin" ; then
@@ -409,7 +418,7 @@ check_shell_magic() {
409418 fi
410419 fi
411420
412- SHELL=$( basename " $SHELL " ) # just in case
421+ SHELL=$( basename " $SHELL " )
413422
414423 __TEA_ONE_LINER=" test -d \" $TEA_DESTDIR_WRITABLE \" && source <(\" $TEA_DESTDIR_WRITABLE /tea.xyz/v*/bin/tea\" --magic=$SHELL --silent)"
415424
502511
503512if ! test -d " $TEA_DESTDIR /tea.xyz/var/pantry" ; then
504513 title=" prefetching"
505- elif command -v git > /dev/null 2>&1 ; then
514+ elif command -v git > /dev/null; then
506515 title=" syncing"
507516fi
508517
0 commit comments