I have watched all of these varieties of yes(1) come whizzing by, and must wonder: Are you all all that bad? If you look closely, you'll see that you are doing a comparision on each execution! Why not: if [ "$#" -gt 1 ] then ans=$* else ans=y fi while true do echo $ans done Check what you want to echo ONCE ONLY, assign it and echo it.