fix: Remove cat (#561)

This commit is contained in:
Kroese 2024-01-14 00:00:59 +01:00 committed by GitHub
parent fcd7b8a825
commit 6422aec780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View File

@ -11,4 +11,4 @@ jobs:
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: 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

View File

@ -9,7 +9,7 @@ address="/run/shm/qemu.ip"
[ ! -f "$file" ] && echo "DSM has not enabled networking yet.." && exit 1 [ ! -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 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" echo "Failed to reach DSM at port $port"
else else
echo "Failed to reach DSM at http://$location" echo "Failed to reach DSM at http://$location"
ip="$(cat "$address")" ip=$(<"$address")
fi fi
echo "You might need to whitelist IP $ip in the DSM firewall." && exit 1 echo "You might need to whitelist IP $ip in the DSM firewall." && exit 1

View File

@ -4,7 +4,7 @@ set -Eeuo pipefail
: ${URL:=''} # URL of the PAT file to be downloaded. : ${URL:=''} # URL of the PAT file to be downloaded.
if [ -f "$STORAGE/dsm.ver" ]; then if [ -f "$STORAGE/dsm.ver" ]; then
BASE=$(cat "$STORAGE/dsm.ver") BASE=$(<"$STORAGE/dsm.ver")
else else
# Fallback for old installs # Fallback for old installs
BASE="DSM_VirtualDSM_42962" BASE="DSM_VirtualDSM_42962"

View File

@ -36,7 +36,7 @@ finish() {
if [ -f "$QEMU_PID" ]; then if [ -f "$QEMU_PID" ]; then
pid="$(cat "$QEMU_PID")" pid=$(<"$QEMU_PID")
echo && error "Forcefully terminating QEMU process, reason: $reason..." echo && error "Forcefully terminating QEMU process, reason: $reason..."
{ kill -15 "$pid" || true; } 2>/dev/null { kill -15 "$pid" || true; } 2>/dev/null
@ -65,7 +65,7 @@ terminal() {
if [ -f "$QEMU_OUT" ]; then if [ -f "$QEMU_OUT" ]; then
local msg local msg
msg="$(cat "$QEMU_OUT")" msg=$(<"$QEMU_OUT")
if [ -n "$msg" ]; then if [ -n "$msg" ]; then
@ -117,7 +117,7 @@ _graceful_shutdown() {
finish "$code" && return "$code" finish "$code" && return "$code"
fi fi
pid="$(cat "$QEMU_PID")" pid=$(<"$QEMU_PID")
if ! isAlive "$pid"; then if ! isAlive "$pid"; then
echo && error "QEMU process does not exist?" echo && error "QEMU process does not exist?"

View File

@ -61,7 +61,7 @@ done
[ -f "$shutdown" ] && exit 1 [ -f "$shutdown" ] && exit 1
location=$(cat "$file") location=$(<"$file")
if [[ "$location" != "20.20"* ]]; then if [[ "$location" != "20.20"* ]]; then
@ -69,7 +69,7 @@ if [[ "$location" != "20.20"* ]]; then
else else
ip="$(cat "$address")" ip=$(<"$address")
port="${location##*:}" port="${location##*:}"
if [[ "$ip" == "172."* ]]; then if [[ "$ip" == "172."* ]]; then

View File

@ -53,7 +53,7 @@ else
HTML=$(html "xxx") HTML=$(html "xxx")
{ echo "#!/bin/bash" { echo "#!/bin/bash"
echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$(cat \"/run/shm/dsm.url\")" echo "[ -f \"/run/shm/dsm.url\" ] && LOCATION=\$(</run/shm/dsm.url)"
echo "HTML=\"$HTML\"; [ -z \"\$LOCATION\" ] && BODY=\"$WAIT\" || BODY=\"$BODY\"; HTML=\${HTML/xxx/\$BODY}" echo "HTML=\"$HTML\"; [ -z \"\$LOCATION\" ] && BODY=\"$WAIT\" || BODY=\"$BODY\"; HTML=\${HTML/xxx/\$BODY}"
echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\"" echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\""
} > "$TMP_FILE" } > "$TMP_FILE"