diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hwmon | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -2,6 +2,7 @@ set -eu +cr=0 debug=0 err() @@ -169,7 +170,10 @@ print_sensor() printf ' ' i=$((${i} + 1)) done - printf ' %s\n' "${value}" + case "${cr}" in + 1) printf ' %s\r' "${value}";; + 0) printf ' %s\n' "${value}";; + esac return 0 } @@ -191,8 +195,9 @@ main() local chip= local element= - while getopts 'd' opt "${@}"; do + while getopts 'rd' opt "${@}"; do case "${opt}" in + 'r') cr=1;; 'd') debug=1;; '?') usage 1>&2 @@ -222,7 +227,10 @@ main() label="${sensor%%:*}" sensor="${sensor#*:}" case "${sensor}" in '') - printf '%s\n' "${label}" + case "${cr}" in + 1) printf '%s\r' "${label}";; + 0) printf '%s\n' "${label}";; + esac continue esac chip="${sensor%/*}" |