Wait given time unless key pressed

Hello everyone.
I'm trying to create a script that waits a given amount of time unless a given key is pressed. I found a very useful thread here

however, I cannot figure out a way of avoiding the keypress if the countdown hits zero. is this possible?

Thanks in advance.

If you are coding in bash -

 read -t 10 myvariable

This times out and continues after 10 seconds.

I'm using the original bourne shell. I'd prefer it if the key were a single custom key like the dd trick provides, but I guess I can just make that key the return key and use read with a timeout if I can't think of a way to do that. Thank you.