command1|grep val | read val; if [[$val -eq 1]] then; do .. ; else ..; fi;