I'm trying to set automatically the verbose and xtrace options for shells which are reading their commands from a standard input which is not connected to a terminal (that test is a proxy for being executed by the at(1) and batch(1) commands, if there is a better one it would be acceptable as well).
I'd have though that
if [[ -o SHIN_STDIN ]] && ! test -t 0 ; then
PS4="> "
setopt verbose xtrace
fi
in my .zshenv would do the trick but that's not the case although I've checked that the .zshenv is indeed correctly executed and that when launching [[ -o SHIN_STDIN ]] && !test -t 0 && echo OK with batch I get the expected email.
What am I missing?
Note tcsh consider such shells as interactive (it set prompt to a non null value). zsh does not (testing with -o interactive, .zprofile, .zshrc are not read). What I find strange is that -o SHIN_STDIN change of value between .zshenv and the execution of commands registered with batch.