|
@@ -1,5 +1,7 @@ |
|
|
#!/usr/bin/env bash |
|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
# g14control.sh |
|
|
# g14control.sh |
|
|
# |
|
|
# |
|
|
# version: 1.0 |
|
|
# version: 1.0 |
|
@@ -27,14 +29,16 @@ disp() { |
|
|
STEP=$((MAX/10)) |
|
|
STEP=$((MAX/10)) |
|
|
CURRLEVEL=$(cat ${INTERFACE}) |
|
|
CURRLEVEL=$(cat ${INTERFACE}) |
|
|
|
|
|
|
|
|
[[ ${1} =~ ^[0-9]{1,${#MAX}}$ && ! ${1} > ${MAX} ]] && \ |
|
|
|
|
|
|
|
|
if [[ ${1} =~ ^[0-9]{1,${#MAX}}$ && ! ${1} > ${MAX} ]]; then |
|
|
LEVEL=${1} |
|
|
LEVEL=${1} |
|
|
[[ ${1} == "up" && ${CURRLEVEL} < ${MAX} ]] && \ |
|
|
|
|
|
LEVEL=$((CURRLEVEL+STEP)) |
|
|
|
|
|
[[ ${1} == "down" && ${CURRLEVEL} > 0 ]] && \ |
|
|
|
|
|
LEVEL=$((CURRLEVEL-STEP)) |
|
|
|
|
|
|
|
|
elif [[ ${1} == "up" && ${CURRLEVEL} < ${MAX} ]]; then |
|
|
|
|
|
[[ $((CURRLEVEL+STEP)) > ${MAX} ]] && \ |
|
|
|
|
|
LEVEL=${MAX} || LEVEL=$((CURRLEVEL+STEP)) |
|
|
|
|
|
else [[ ${1} == "down" && ${CURRLEVEL} > 0 ]] |
|
|
|
|
|
[[ $((CURRLEVEL-STEP)) < 0 ]] && \ |
|
|
|
|
|
LEVEL=0 || LEVEL=$((CURRLEVEL-STEP)) |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
echo ${LEVEL} |
|
|
|
|
|
echo ${LEVEL} > ${INTERFACE} |
|
|
echo ${LEVEL} > ${INTERFACE} |
|
|
|
|
|
|
|
|
CHKLEVEL=$(cat ${INTERFACE}) |
|
|
CHKLEVEL=$(cat ${INTERFACE}) |
|
|