diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7341419..ee48e42 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,4 +11,4 @@ jobs: - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: - SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2153 -e SC2028 + SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2153 -e SC2028 diff --git a/src/check.sh b/src/check.sh index 771127b..9a692dc 100644 --- a/src/check.sh +++ b/src/check.sh @@ -9,7 +9,7 @@ address="/run/shm/qemu.ip" [ ! -f "$file" ] && echo "DSM has not enabled networking yet.." && exit 1 -location=$(cat "$file") +location=$(<"$file") if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then @@ -19,7 +19,7 @@ if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then echo "Failed to reach DSM at port $port" else echo "Failed to reach DSM at http://$location" - ip="$(cat "$address")" + ip=$(<"$address") fi echo "You might need to whitelist IP $ip in the DSM firewall." && exit 1 diff --git a/src/install.sh b/src/install.sh index b0812d8..52f1fd0 100644 --- a/src/install.sh +++ b/src/install.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail : ${URL:=''} # URL of the PAT file to be downloaded. if [ -f "$STORAGE/dsm.ver" ]; then - BASE=$(cat "$STORAGE/dsm.ver") + BASE=$(<"$STORAGE/dsm.ver") else # Fallback for old installs BASE="DSM_VirtualDSM_42962" diff --git a/src/power.sh b/src/power.sh index 416cd89..25f6576 100644 --- a/src/power.sh +++ b/src/power.sh @@ -36,7 +36,7 @@ finish() { if [ -f "$QEMU_PID" ]; then - pid="$(cat "$QEMU_PID")" + pid=$(<"$QEMU_PID") echo && error "Forcefully terminating QEMU process, reason: $reason..." { kill -15 "$pid" || true; } 2>/dev/null @@ -65,7 +65,7 @@ terminal() { if [ -f "$QEMU_OUT" ]; then local msg - msg="$(cat "$QEMU_OUT")" + msg=$(<"$QEMU_OUT") if [ -n "$msg" ]; then @@ -117,7 +117,7 @@ _graceful_shutdown() { finish "$code" && return "$code" fi - pid="$(cat "$QEMU_PID")" + pid=$(<"$QEMU_PID") if ! isAlive "$pid"; then echo && error "QEMU process does not exist?" diff --git a/src/print.sh b/src/print.sh index 6d42cc4..46d3e54 100644 --- a/src/print.sh +++ b/src/print.sh @@ -61,7 +61,7 @@ done [ -f "$shutdown" ] && exit 1 -location=$(cat "$file") +location=$(<"$file") if [[ "$location" != "20.20"* ]]; then @@ -69,7 +69,7 @@ if [[ "$location" != "20.20"* ]]; then else - ip="$(cat "$address")" + ip=$(<"$address") port="${location##*:}" if [[ "$ip" == "172."* ]]; then diff --git a/src/server.sh b/src/server.sh index e4a12fe..95f25d5 100644 --- a/src/server.sh +++ b/src/server.sh @@ -53,7 +53,7 @@ else HTML=$(html "xxx") { echo "#!/bin/bash" - echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$(cat \"/run/shm/dsm.url\")" + echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$( "$TMP_FILE"