#!/bin/bash if [[ $# != 1 || $((-(-$1))) != $1 ]]; then echo "Usage: $0 cnannel [!0-7 == all off]" >&2 exit 1 fi CMD="0" [[ $1 -ge 0 && $1 -le 7 ]] && CMD=$((1 << $1)) echo "send $CMD" i2ctransfer -y 6 w1@0x70 $CMD i2cdetect -y -r 6