shithub: bin.rc

Download patch

ref: e30bac13912ad2f9923542d9e72c327347005365
parent: 6a34b0e46ad23af977dc230f885161f8bdc15520
author: kvik <[email protected]>
date: Sat Apr 18 19:09:08 EDT 2020

vol: improve code readability by a bit

--- a/bin/vol
+++ b/bin/vol
@@ -4,11 +4,12 @@
 usage='vol [-+] | [+-]vol | vol'
 
 fn expr {
-	switch($2){
+	op=$2
+	switch($op){
 	case [-+][0-9]*
-		echo $1 $2 | bc
+		echo $1 $op | bc
 	case - +
-		echo $1 $2 5 | bc
+		echo $1 $op $step | bc
 	case *
 		echo $2
 	}
@@ -17,6 +18,7 @@
 if(~ $#* 0)
 	usage
 
+step=5
 vol=`{awk '/master/ {print $2, $3}' </dev/volume}
 switch($#*){
 case 1