If stdin is not a tty, abort rather than prompt the user.
A missing $ caused the script to look in the wrong place when trying
to determine whether this was a first or subsequent run - but only
when backing up a non-root dataset.

Also, use [ -t 0 ] instead of tty(1).