From bf064c8390560bd313ccf996baa89392caae1fc6 Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Fri, 1 Jun 2018 16:20:54 +0000 Subject: SC2006: Use $(..) instead of legacy `..`. Backtick command substitution `STATEMENT` is legacy syntax with several issues. - It has a series of undefined behaviors related to quoting in POSIX. - It imposes a custom escaping mode with surprising results. - It's exceptionally hard to nest. $(STATEMENT) command substitution has none of these problems, and is therefore strongly encouraged. PR: 227109 Submitted by: mat Sponsored by: Absolight --- Mk/Scripts/actual-package-depends.sh | 2 +- Mk/Scripts/create-manifest.sh | 4 ++-- Mk/Scripts/find-lib.sh | 4 ++-- Mk/Scripts/qa.sh | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Mk/Scripts') diff --git a/Mk/Scripts/actual-package-depends.sh b/Mk/Scripts/actual-package-depends.sh index 18af33e57d39..d773efa96a84 100644 --- a/Mk/Scripts/actual-package-depends.sh +++ b/Mk/Scripts/actual-package-depends.sh @@ -17,7 +17,7 @@ resolv_symlink() { return fi - tgt=`readlink ${file}` + tgt=$(readlink ${file}) case $tgt in /*) echo $tgt diff --git a/Mk/Scripts/create-manifest.sh b/Mk/Scripts/create-manifest.sh index 25f9c999c636..974198cf7928 100644 --- a/Mk/Scripts/create-manifest.sh +++ b/Mk/Scripts/create-manifest.sh @@ -57,8 +57,8 @@ EOT [ -z "${dp_LICENSE}" ] || echo "licenses: [ ${dp_LICENSE} ]" [ -z "${dp_USERS}" ] || echo "users: [ ${dp_USERS} ]" [ -z "${dp_GROUPS}" ] || echo "groups: [ ${dp_GROUPS} ]" -[ -n "${dp_NO_ARCH}" ] && echo "arch : `${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2`:*" -[ -n "${dp_NO_ARCH}" ] && echo "abi : `${dp_PKG_BIN} config abi | cut -d: -f1,2`:*" +[ -n "${dp_NO_ARCH}" ] && echo "arch : $(${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2):*" +[ -n "${dp_NO_ARCH}" ] && echo "abi : $(${dp_PKG_BIN} config abi | cut -d: -f1,2):*" # Then the key/values sections echo "deps: { " diff --git a/Mk/Scripts/find-lib.sh b/Mk/Scripts/find-lib.sh index e442bcb7f2e9..80c830ac14fa 100644 --- a/Mk/Scripts/find-lib.sh +++ b/Mk/Scripts/find-lib.sh @@ -22,12 +22,12 @@ if [ $# -ne 1 ]; then fi lib=$1 -dirs="${LIB_DIRS} `cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`" +dirs="${LIB_DIRS} $(cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :)" for libdir in ${dirs} ; do test -f ${libdir}/${lib} || continue libfile=${libdir}/${lib} - [ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue + [ $(file -b -L --mime-type ${libfile}) = "application/x-sharedlib" ] || continue echo $libfile break done diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index dbc2afc24dd3..7b4c25122839 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -248,9 +248,9 @@ sharedmimeinfo() { suidfiles() { local filelist - filelist=`find ${STAGEDIR} -type f \ + filelist=$(find ${STAGEDIR} -type f \ \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ - \( -perm -u+s -or -perm -g+s \)` + \( -perm -u+s -or -perm -g+s \)) if [ -n "${filelist}" ]; then warn "setuid files in the stage directory (are these necessary?):" ls -liTd ${filelist} @@ -278,12 +278,12 @@ libperl() { # No results presents a blank line from heredoc. [ -z "${f}" ] && continue files=$((files+1)) - found=`readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100} + found=$(readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100} /NEEDED.*${LIBPERL}/ { libperl = 0 } /RPATH.*perl.*CORE/ { rpath = 0 } /RUNPATH.*perl.*CORE/ { runpath = 0 } END {print libperl+rpath+runpath} - "` + ") case "${found}" in *1) warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?" -- cgit v1.2.3