in reply to if -d
Missed it myself intially ...
What you have is a quoting problem - try rewriting 'yes' to read "yes" ... or even q/yes/