From f654a9fcf2c3c5e348ea43a341e973a0ccbca7c7 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 10 Jun 2024 12:25:06 +0300 Subject: Refactoring --- bin/ak-fs-add | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/ak-fs-add b/bin/ak-fs-add index f22432b..0a9f636 100755 --- a/bin/ak-fs-add +++ b/bin/ak-fs-add @@ -65,7 +65,7 @@ rm -rf $TEMPORARYDIR if [ ! -d "$TECHDIR" ] then mkdir -p "$TECHDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $TECHDIR created!" else @@ -80,7 +80,7 @@ fi if [ ! -d "$FILEMAPSDIR" ] then mkdir -p "$FILEMAPSDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $FILEMAPSDIR created!" else @@ -95,7 +95,7 @@ fi if [ ! -d "$CHKDIR" ] then mkdir -p "$CHKDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $CHKDIR created!" else @@ -110,7 +110,7 @@ fi if [ ! -d "$MERKLEDIR" ] then mkdir -p "$MERKLEDIR" - if [ $? == 0 ] + if [ $? -eq 0 ] then logit "INFO" "Folder $MERKLEDIR created!" else @@ -153,7 +153,7 @@ do done # Append last chk if not even number appendLastIfNotEven(){ - if [ "$(expr $(wc -l "$1" | awk '{ print $1 }') % 2)" != 0 ] + if [ "$(( $(wc -l "$1" | awk '{ print $1 }') % 2))" -ne 0 ] then tail -n 1 "$1" >> "$1" fi @@ -163,7 +163,7 @@ appendLastIfNotEven "$TEMPORARYDIR/map" totalChunks=`grep 'chk' $TEMPORARYDIR/map | wc -l` temp="$totalChunks" timesRan=0 -while [ $temp != 1 ] +while [ $temp -ne 1 ] do temp=`expr $temp / 2` timesRan=`expr $timesRan + 1` @@ -173,7 +173,7 @@ printf "Total chunks %s \n" "$totalChunks" workingIndex="$TEMPORARYDIR/map" c=$timesRan -while [ "$c" != 0 ] +while [ $c -ne 0 ] do a=1 printf "Level: %s, will work on %s chunks\n" "$c" "$totalChunks" -- cgit v1.2.3