To improve the user experience on this site we use cookies. I agree | I disagree

How can I read binary input in a script?

In category Routers .


You can do this

/usr/bin/io get bin0
VAL=$?

 

or this (preferred)

VAL=`/usr/bin/io get bin0`

 

or you can read state of binary input directly in e.g. condition if.

if [ `io get bin0` -eq 1 ]; then
 .
 .
 .
fi

 

 

To the FAQ overview