read command is giving same answer to following read commands

first question

I answer yes

second question gets answered yes automatically

I know that the REPLY env is set after answering a question

after getting the answer I dont unset the REPLY env. and since I’m sourcing the script that holds this code

The period signify’s sourcing a script

REPLY gets set globally across the parent shell, so the next time read is used, $REPLY is already set.

unset REPLY

this fixes it

Leave a Reply

Your email address will not be published.