|
@@ -29,14 +29,18 @@ disp() { |
|
|
STEP=$((MAX/10)) |
|
|
STEP=$((MAX/10)) |
|
|
CURRLEVEL=$(cat ${INTERFACE}) |
|
|
CURRLEVEL=$(cat ${INTERFACE}) |
|
|
|
|
|
|
|
|
if [[ ${1} =~ ^[0-9]{1,${#MAX}}$ && ! ${1} > ${MAX} ]]; then |
|
|
|
|
|
LEVEL=${1} |
|
|
|
|
|
elif [[ ${1} == "up" && ${CURRLEVEL} < ${MAX} ]]; then |
|
|
|
|
|
|
|
|
if [[ ${1} == "up" ]]; then |
|
|
[[ $((CURRLEVEL+STEP)) > ${MAX} ]] && \ |
|
|
[[ $((CURRLEVEL+STEP)) > ${MAX} ]] && \ |
|
|
LEVEL=${MAX} || LEVEL=$((CURRLEVEL+STEP)) |
|
|
|
|
|
else [[ ${1} == "down" && ${CURRLEVEL} > 0 ]] |
|
|
|
|
|
|
|
|
LEVEL=${MAX} || \ |
|
|
|
|
|
[[ ${CURRLEVEL} < ${MAX} ]] && \ |
|
|
|
|
|
LEVEL=$((CURRLEVEL+STEP)) |
|
|
|
|
|
elif [[ ${1} == "down" ]]; then |
|
|
[[ $((CURRLEVEL-STEP)) < 0 ]] && \ |
|
|
[[ $((CURRLEVEL-STEP)) < 0 ]] && \ |
|
|
LEVEL=0 || LEVEL=$((CURRLEVEL-STEP)) |
|
|
|
|
|
|
|
|
LEVEL=0 || |
|
|
|
|
|
[[ ${CURRLEVEL} > 0 ]] && \ |
|
|
|
|
|
LEVEL=$((CURRLEVEL-STEP)) |
|
|
|
|
|
elif [[ ${1} =~ ^[0-9]{1,${#MAX}}$ && ! ${1} > ${MAX} ]]; then |
|
|
|
|
|
LEVEL=${1} |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
echo ${LEVEL} > ${INTERFACE} |
|
|
echo ${LEVEL} > ${INTERFACE} |
|
|