Succinct way to respond to user input?

view story

http://unix.stackexchange.com – Of course you can do this sort of thing, read var; if [[ $var = 'y' ]]; then echo "Yes"; fi But is there any way to skip the first step and do something a little more like this, (ideally without needing a subshell): if [[ $(read var) = 'y' ]]; then echo "Yes"; fi Of course the above doesn't work unless you add echo, but I'm looking for something much cleaner and simpler than this: if [[ $(read var; echo "$var") = 'y' ]]; then echo "Yes"; fi It would be ideal if this would work: if [[ read = 'y' ]]; then echo "Yes"; fi (HowTos)