found bug with stris_posix regex, fixed fdivide_posix
This commit is contained in:
parent
5ed6294f67
commit
bb9777ef27
@ -86,7 +86,7 @@ printbar() {
|
|||||||
fdivide_posix() {
|
fdivide_posix() {
|
||||||
[ -n "$2" ] && [ -n "$1" ] && [ -z "$3" ] \
|
[ -n "$2" ] && [ -n "$1" ] && [ -z "$3" ] \
|
||||||
|| return 1
|
|| return 1
|
||||||
printf "%b" "$(($2/$1))"
|
printf "%b\n" "$(($1/$2))"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ gt_posix() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# limited POSIX shell version of stris
|
# limited POSIX shell version of stris
|
||||||
|
# BROKEN REGEX. MUSTFIX.
|
||||||
stris_posix() {
|
stris_posix() {
|
||||||
[ -n "$2" ] || return 1
|
[ -n "$2" ] || return 1
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -122,22 +123,33 @@ stris_posix() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$POSIXLY_CORRECT" ]; then
|
# check to make sure we have non-standard utilities
|
||||||
alias fdivide="fdivide_posix"
|
|
||||||
alias gt="gt_posix"
|
[ -n "$POSIXLY_CORRECT" ] || ! which fdivide >/dev/null 2>&1 \
|
||||||
alias stris="stris_posix"
|
&& alias fdivide="fdivide_posix" \
|
||||||
fi
|
|| true
|
||||||
|
|
||||||
|
[ -n "$POSIXLY_CORRECT" ] || ! which gt >/dev/null 2>&1 \
|
||||||
|
&& alias gt="gt_posix" \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
[ -n "$POSIXLY_CORRECT" ] || ! which stris >/dev/null 2>&1 \
|
||||||
|
&& alias stris="stris_posix" \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
# check to make sure customizeable vars are in proper format
|
||||||
|
|
||||||
[ -n "$INTERVAL" ] && stris int "$INTERVAL" \
|
[ -n "$INTERVAL" ] && stris int "$INTERVAL" \
|
||||||
|| INTERVAL=1 \
|
|| INTERVAL=1
|
||||||
&& true
|
|
||||||
[ -n "$CPU_TEMP_SCALE" ] && stris int "$CPU_TEMP_SCALE" \
|
[ -n "$CPU_TEMP_SCALE" ] && stris int "$CPU_TEMP_SCALE" \
|
||||||
&& gt "$CPU_TEMP_SCALE" 0 \
|
&& gt "$CPU_TEMP_SCALE" 0 \
|
||||||
|| CPU_TEMP_SCALE=1 \
|
|| CPU_TEMP_SCALE=1
|
||||||
&& true
|
|
||||||
[ -n "$CPU_TEMP_FILES" ] \
|
[ -n "$CPU_TEMP_FILES" ] \
|
||||||
|| alias get_cpu_temp="printf '[no temperature files specified]\n'" \
|
|| alias get_cpu_temp="printf '[no temperature files specified]\n'"
|
||||||
&& true
|
|
||||||
|
# main loop
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
printbar
|
printbar
|
||||||
|
Loading…
Reference in New Issue
Block a user