[PATCH] zram-swap: init: replace backticks with $()

Rui Salvaterra rsalvaterra at gmail.com
Tue Jun 30 12:23:12 EDT 2020


Signed-off-by: Rui Salvaterra <rsalvaterra at gmail.com>
---
 package/system/zram-swap/files/zram.init | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index d33e779850..a6126e578f 100755
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -73,7 +73,7 @@ zram_getdev()
 	local zdev=$( zram_dev )
 
 	if [ "$(mount | grep $zdev)" ]; then
-		local idx=`cat /sys/class/zram-control/hot_add`
+		local idx=$(cat /sys/class/zram-control/hot_add)
 		zdev="$( zram_dev $idx )"
 	fi
 
@@ -89,7 +89,7 @@ zram_comp_algo()
 		return 0
 	fi
 
-	if [ `grep -c "$zram_comp_algo" /sys/block/$( basename $dev )/comp_algorithm` -ne 0 ]; then
+	if [ $(grep -c "$zram_comp_algo" /sys/block/$( basename $dev )/comp_algorithm) -ne 0 ]; then
 		logger -s -t zram_comp_algo -p daemon.debug "Set compression algorithm '$zram_comp_algo' for zram '$dev'"
 		echo $zram_comp_algo > "/sys/block/$( basename $dev )/comp_algorithm"
 	else
@@ -147,8 +147,8 @@ zram_compact()
 	# compact zram device (reduce memory allocation overhead)
 	local zdev="/sys/block/$( basename "$1" )"
 
-	local old_mem_used=`awk '{print $3}' <$zdev/mm_stat`
-	local old_overhead=`awk '{print $3-$2}' <$zdev/mm_stat`
+	local old_mem_used=$(awk '{print $3}' <$zdev/mm_stat)
+	local old_overhead=$(awk '{print $3-$2}' <$zdev/mm_stat)
 
 	echo 1 > $zdev/compact
 
-- 
2.27.0




More information about the openwrt-devel mailing list