zram-swap: init: replace backticks with $()
authorRui Salvaterra <rsalvaterra@gmail.com>
Tue, 30 Jun 2020 16:23:12 +0000 (17:23 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 30 Jun 2020 17:03:15 +0000 (19:03 +0200)
This replaces deprecated backticks by more versatile $(...) syntax.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
[add commit description]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
package/system/zram-swap/files/zram.init

index 49140ad40658620c9fc6d757dacf3f21021151a0..c855bbc087d2b8c86c270725f1533025e63ff9cd 100755 (executable)
@@ -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