diff options
author | David Phillips <david@yeah.nah.nz> | 2020-09-05 15:44:37 +1200 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2020-09-05 15:56:17 +1200 |
commit | 76f2d2c7429a4b85aceafa0080df0af3cd1ad2b5 (patch) | |
tree | 0c52782a55fe430c7f40ed79f647afe42e54a273 /test/002-test-key-name.test/run.sh | |
parent | 6d81ef9443797d9174fc0849f8ec01d423754490 (diff) | |
download | sand-leek-76f2d2c7429a4b85aceafa0080df0af3cd1ad2b5.tar.xz |
Adjust tests to pass shellcheck
Fixes warnings around use of various shell no-nos
Diffstat (limited to 'test/002-test-key-name.test/run.sh')
-rwxr-xr-x | test/002-test-key-name.test/run.sh | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/002-test-key-name.test/run.sh b/test/002-test-key-name.test/run.sh index aa2adca..0f7df69 100755 --- a/test/002-test-key-name.test/run.sh +++ b/test/002-test-key-name.test/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -13,15 +13,15 @@ key="$(mktemp)" stderr="$(mktemp)" # Four character search should be a < 1 second CPU burst for CI runner -${EXECUTABLE} -s site > $key 2>$stderr +${EXECUTABLE} -s site > "$key" 2>"$stderr" -found=($(tr '\r' '\n' < $stderr | grep Found | cut -d ' ' -f 3)) +mapfile -t found < <(tr '\r' '\n' < "$stderr" | grep Found | cut -d ' ' -f 3) echo "sand-leek says it found ${found[*]}..." # Trick adapted to py3 from https://swehack.org/viewtopic.php?f=37&p=6978 real="$( \ - openssl rsa -in $key -pubout -outform DER \ + openssl rsa -in "$key" -pubout -outform DER \ | tail -c +23 \ | $SHASUM \ | head -c 20 \ @@ -33,8 +33,7 @@ echo "Key analysis shows it's for ${real}" for f in "${found[@]}" ; do if [ "$f" == "$real" ] ; then echo "Found a match, I'm happy" - rm $key - rm $stderr + rm -- "$key" "$stderr" exit 0 fi done |