[mc-devel] [PATCH] Prefer $() to backticks in sh script

Matěj Cepl mcepl at cepl.eu
Sat Nov 2 10:06:04 UTC 2024


Both of them are perfectly standard [1], but my old eyes really
prefer the command substitution syntax.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03
---
 contrib/mc-wrapper.sh.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/mc-wrapper.sh.in b/contrib/mc-wrapper.sh.in
index 3d929b348..954cb13f5 100644
--- a/contrib/mc-wrapper.sh.in
+++ b/contrib/mc-wrapper.sh.in
@@ -1,15 +1,15 @@
 if test -n "$MC_TMPDIR"; then
-	MC_PWD_FILE="`mktemp "${MC_TMPDIR}/mc.pwd.XXXXXX"`"
+	MC_PWD_FILE="$(mktemp "${MC_TMPDIR}/mc.pwd.XXXXXX")"
 elif test -n "$TMPDIR"; then
-	MC_PWD_FILE="`mktemp "${TMPDIR}/mc.pwd.XXXXXX"`"
+	MC_PWD_FILE="$(mktemp "${TMPDIR}/mc.pwd.XXXXXX")"
 else
-	MC_PWD_FILE="`mktemp "/tmp/mc.pwd.XXXXXX"`"
+	MC_PWD_FILE="$(mktemp "/tmp/mc.pwd.XXXXXX")"
 fi
 
 @bindir@/mc -P "$MC_PWD_FILE" "$@"
 
 if test -r "$MC_PWD_FILE"; then
-	MC_PWD="`cat "$MC_PWD_FILE"`"
+	MC_PWD="$(cat "$MC_PWD_FILE")"
 	if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
 		cd "$MC_PWD" || true
 	fi
-- 
2.47.0



More information about the mc-devel mailing list