diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-04-26 18:49:11 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-04-26 18:49:11 (EDT) |
commit | 69da9f04d7db027425038d884257014425ec847c (patch) | |
tree | 7229a112cceac92c8145f1995f18ef193edc3246 | |
parent | 8aaba16047f903ca1b5ceb3eb60a64a4151efba7 (diff) | |
download | fluxbox-69da9f04d7db027425038d884257014425ec847c.zip fluxbox-69da9f04d7db027425038d884257014425ec847c.tar.gz fluxbox-69da9f04d7db027425038d884257014425ec847c.tar.bz2 |
bin/hwmon: Optionally print CRs instead of LFs
-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%/*}" |