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