fix shellcheck errors in 2004/hibachi/src/localhost/test/shell/test1.sh

This commit is contained in:
Landon Curt Noll committed 2024-03-11 00:18:38 -07:00
1 parent a0d7660712
commit fc8e3ec052
1 file changed
+15 -7
+15 -7
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
cat <<'-EOT-'
HTTP/1.0 200 OK
@@ -29,31 +29,33 @@ Hibachi/1.0 Shell Test 1
<caption><h3>Assertions</h3></caption>
-EOT-
if [ X"$PATH" = X'/usr/local/bin:/usr/bin:/bin' ]; then
if [[ $PATH == '/usr/local/bin:/usr/bin:/bin' ]]; then
echo "<tr><td>[ OK ] PATH</td></tr>"
else
echo "<tr><td>[ BAD ] PATH</td></tr>"
fi
if [ X"$ENV" = X ]; then
if [[ -z $ENV ]]; then
echo "<tr><td>[ OK ] ENV</td></tr>"
else
echo "<tr><td>[ BAD ] ENV</td></tr>"
fi
if [ X"$CDPATH" = X ]; then
if [[ -z $CDPATH ]]; then
echo "<tr><td>[ OK ] CDPATH</td></tr>"
else
echo "<tr><td>[ BAD ] CDPATH</td></tr>"
fi
if [ X"$REQUEST_METHOD" = X'GET' ]; then
if [[ -z $REQUEST_METHOD ]]; then REQUEST_METHOD=''; fi
if [[ $REQUEST_METHOD == 'GET' ]]; then
echo "<tr><td>[ OK ] REQUEST_METHOD</td></tr>"
else
echo "<tr><td>[ BAD ] REQUEST_METHOD</td></tr>"
fi
if [ X"$QUERY_STRING" = X'example=GET+REQUEST+WITH+QUERY-STRING&garibaldi=peek-a-boo' ]; then
if [[ -z $QUERY_STRING ]]; then QUERY_STRING=''; fi
if [[ $QUERY_STRING == 'example=GET+REQUEST+WITH+QUERY-STRING&garibaldi=peek-a-boo' ]]; then
echo "<tr><td>[ OK ] QUERY_STRING</td></tr>"
else
echo "<tr><td>[ BAD ] QUERY_STRING</td></tr>"
@@ -61,7 +63,13 @@ fi
echo "</table>"
. "$DOCUMENT_ROOT/test/shell/dump.sh"
if [[ -z $DOCUMENT_ROOT ]]; then DOCUMENT_ROOT='.'; fi
# We want to source the file, but for SC1091 the file is not available at the time of this edit.
#
# SC1091 (info): Not following: ./test/shell/dump.sh was not specified as input (see shellcheck -x).
# https://www.shellcheck.net/wiki/SC1091
# shellcheck disable=SC1091
source "$DOCUMENT_ROOT/test/shell/dump.sh"
cat <<'-EOT-'
<br>