From 65878aa07452b45c3f17c3ab15508400edd46476 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 18 Sep 2024 07:56:39 +0200 Subject: Some shellcheck --- utils/genmovecode.sh | 2 +- utils/genmoveswitch.sh | 2 +- utils/gentranscode.sh | 2 +- utils/gentransswitch.sh | 4 ++-- utils/gentranstests.sh | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'utils') diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh index ddde0f7..cf13441 100755 --- a/utils/genmovecode.sh +++ b/utils/genmovecode.sh @@ -4,7 +4,7 @@ cc -DDEBUG h48_to_lst.c ../src/nissy.c -o h48_to_lst gen() { for f in cubes/move_??_*.txt; do - move="$(echo $f | sed 's/.*_// ; s/\.txt//')" + move="$(echo "$f" | sed 's/.*_// ; s/\.txt//')" printf '#define _move_cube_%s fastcube( \\\n ' "$move" ./h48_to_lst <"$f" printf ')\n' diff --git a/utils/genmoveswitch.sh b/utils/genmoveswitch.sh index 4fe057c..3b2a74b 100755 --- a/utils/genmoveswitch.sh +++ b/utils/genmoveswitch.sh @@ -2,7 +2,7 @@ printf '\tswitch (m) {\n' for f in cubes/move_??_*.txt; do - t="$(echo $f | sed 's/.*_// ; s/\.txt//')" + t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')" printf '\tcase %s:\n\t\treturn _move(%s, c);\n' "$t" "$t" done printf '\t}\n' diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh index e3e199e..9a1de2c 100755 --- a/utils/gentranscode.sh +++ b/utils/gentranscode.sh @@ -10,7 +10,7 @@ sedsrc() { sed '3s/$/ };/ ; 3q'; } gen() { for f in cubes/transform_??_???.txt; do - trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" + trans="$(echo "$f" | sed 's/.*_// ; s/\.txt//')" printf '#define _trans_cube_%s fastcube( \\\n ' "$trans" ./h48_to_lst <"$f" printf ')\n' diff --git a/utils/gentransswitch.sh b/utils/gentransswitch.sh index 447c9be..20e2bfb 100755 --- a/utils/gentransswitch.sh +++ b/utils/gentransswitch.sh @@ -2,8 +2,8 @@ printf '\tswitch (t) {\n' for f in cubes/transform_??_???.txt; do - t="$(echo $f | sed 's/.*_// ; s/\.txt//')" - mirror_or_rotation="$(echo $t | grep m)" + t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')" + mirror_or_rotation="$(echo "$t" | grep m)" if [ -z "$mirror_or_rotation" ]; then m="rotation" else diff --git a/utils/gentranstests.sh b/utils/gentranstests.sh index 62ebbda..a257a0a 100755 --- a/utils/gentranstests.sh +++ b/utils/gentranstests.sh @@ -8,9 +8,9 @@ i=100 while read -r line; do [ -z "$line" ] && continue - trans_piece="$(echo $line | awk '{print $1}' | tr -d 'rm')" - move1="$(echo $line | awk '{print $2}')" - move2="$(echo $line | awk '{print $3}')" + trans_piece="$(echo "$line" | awk '{print $1}' | tr -d 'rm')" + move1="$(echo "$line" | awk '{print $2}')" + move2="$(echo "$line" | awk '{print $3}')" rotation="rotation $trans_piece" @@ -23,7 +23,7 @@ while read -r line; do i=$((i+1)) mirrored="mirrored $trans_piece" - move2m="$(echo ${move2} | tr 'LR' 'RL')3" + move2m="$(echo "${move2}" | tr 'LR' 'RL')3" file1="$(ls cubes | grep "move_.*_${move1}.txt")" file2="$(ls cubes | grep "move_.*_${move2m}.txt")" -- cgit v1.3