Script execute from commandline and print result, but not execute from dwmblocks
#!/usr/bin/env bash
# set -x
DEV_NAME=/dev/sda
function formatted_load() {
iostat -xd "${DEV_NAME}" 1 2 | awk '
/sda/ {
if (++n == 2) {
val = int($NF)
printf "%02d\n", val
}
}
'
}
raw_value=$(formatted_load)
printf "%02d\n" "$raw_value"
Script execute from commandline and print result, but not execute from dwmblocks