From f16471aad409e53c5eac67bc80e8d1b25558062c Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Wed, 15 Dec 2021 02:30:45 +0100 Subject: [PATCH] configure: fix several shellcheck warnings --- configure | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 3097c8c..b9a0c0b 100755 --- a/configure +++ b/configure @@ -1,31 +1,34 @@ #!/bin/sh -printf "Running on " -case `uname -s` in - Linux*) echo "Linux" ;; - Darwin*) echo "Mac" ;; - [CIGWIN,MINGW]*) echo "Windows" ;; - *) echo "unknown OS" ;; +printf 'Running on ' +case $(uname -s) in + Linux*) echo 'Linux' ;; + Darwin*) echo 'Mac' ;; + CYGWIN*|MSYS*|MINGW*) echo 'Windows' ;; + *) echo 'unknown OS' ;; esac -printf "OS version " && uname -r +os=$(uname -r) +printf 'OS version %s\n' "$os" -arch=`uname -m` -echo "Processor architecture $arch" +arch=$(uname -m) +printf 'Processor architecture %s\n' "$arch" check() { - printf "Looking for %s... " $1 && command -v $1 || (echo "not found"; exit 1) + printf 'Looking for %s... ' "$1" + command -v "$1" || (echo 'not found'; exit 1) return $? } for FC in ifort gfortran f77; do check $FC && break done +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then - echo "Fortran compiler not found. Cannot proceed" + printf 'Fortran compiler not found. Cannot proceed\n' exit 1 else - echo "Use $FC as Fortran compiler" + printf 'Use %s as Fortran compiler\n' "$FC" fi # $FC --version