As illustrated below: ◼︎◼︎▶︎ which g1 g2                        g1 () { REPLY=timeout  read -t 5 -k 1 echo REPLY=$REPLY } g2 () { REPLY=timeout  read -u 0 -t 5 -k 1 echo REPLY=$REPLY } ◼︎◼︎▶︎ g1         # no return                           aaREPLY=a ◼︎◼︎▶︎ g2                                    asdf           # return REPLY=a ◼︎◼︎▶︎ sdf                                 zsh: command not found: sdf johnnonedoe@aol.com