Shell help



  • This script works good.
    Using example from Omega2 Documents, Communicating with 1-wire devices.

    #!/bin/ash
    gpioctl dirin 2
    insmod w1-gpio-custom bus0=0,2,0
    while true
    do
    cat /sys/devices/w1_bus_master1/28-0115901482ff/w1_slave
    awk -F= '/t=/ {printf "%.03f\n", $2/1000}' /sys/devices/w1_bus_master1/28-0115901482ff/w1_slave
    sleep 5
    done

    With a result like this
    47 01 4b 46 7f ff 0c 10 6c : crc=6c YES
    47 01 4b 46 7f ff 0c 10 6c t=20437
    20.437

    How can I print only the temperature of 20.437?

    Thanks



  • Possibly leave out the cat line, or if that has necessary side effects (like triggering an actual operation), pipe it to /dev/null



  • @Chris-Stratton
    Thanks Chris. The second solution worked. >.dev/null


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.