From d28480ea677540e86c856fbfd96ac3a9534372e0 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 3 Dec 2020 21:59:54 -0500 Subject: [PATCH] Use single quotes when shell expansions aren't needed --- tools/update-rustc.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/update-rustc.sh b/tools/update-rustc.sh index b9629db28..27ee94204 100755 --- a/tools/update-rustc.sh +++ b/tools/update-rustc.sh @@ -37,16 +37,16 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do cd $tmp_build_directory # Save the previous compile time; we're going to keep it to minimize diff churn - compile_time=$(sed -E -ne "s/.*Finished (dev|test) \[unoptimized \+ debuginfo] target\(s\) in ([0-9.]*).*/\2/p" ${full_output_path}) + compile_time=$(sed -E -ne 's/.*Finished (dev|test) \[unoptimized \+ debuginfo] target\(s\) in ([0-9.]*).*/\2/p' ${full_output_path}) # Save the hash from the first test binary; we're going to keep it to minimize diff churn - test_binary_hash=$(sed -E -ne "s@.*Running target/debug/deps/[^-]*-([^\s]*)@\1@p" ${full_output_path} | head -n 1) + test_binary_hash=$(sed -E -ne 's@.*Running target/debug/deps/[^-]*-([^\s]*)@\1@p' ${full_output_path} | head -n 1) # Act like this is the first time this listing has been built cargo clean # Run the command in the existing output file - cargo_command=$(sed -ne "s/$ \(.*\)/\1/p" ${full_output_path}) + cargo_command=$(sed -ne 's/$ \(.*\)/\1/p' ${full_output_path}) # Clear the output file of everything except the command echo "$ ${cargo_command}" > ${full_output_path} @@ -58,7 +58,7 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do # Set the project file path to the projects directory plus the crate name instead of a path # to the computer of whoever is running this - sed -i '' -E -e "s@(Compiling|Checking) ([^\)]*) v0.1.0 (.*)@\1 \2 v0.1.0 (file:///projects/\2)@" ${full_output_path} + sed -i '' -E -e 's@(Compiling|Checking) ([^\)]*) v0.1.0 (.*)@\1 \2 v0.1.0 (file:///projects/\2)@' ${full_output_path} # Restore the previous compile time, if there is one if [ -n "${compile_time}" ]; then @@ -67,7 +67,10 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do # Restore the previous test binary hash, if there is one if [ -n "${test_binary_hash}" ]; then - sed -i '' -E -e "s@Running target/debug/deps/([^-]*)-([^\s]*)$@Running target/debug/deps/\1-${test_binary_hash}@g" ${full_output_path} + replacement='s@Running target/debug/deps/([^-]*)-([^\s]*)$@Running target/debug/deps/\1-' + replacement+="${test_binary_hash}" + replacement+='@g' + sed -i '' -E -e "${replacement}" ${full_output_path} fi cd - > /dev/null