Hi.
Does any one know when the below will print hi ?
[ -t 0 ] || echo hi
Thanks in advance
Hi.
Does any one know when the below will print hi ?
[ -t 0 ] || echo hi
Thanks in advance
It belongs to which shell and which script..
Very simple way to test: enter it in your terminal emulation / console.
man test :
-t [fildes] True if the open file whose file descriptor number
is fildes (1 by default) is associated with a
terminal device.
If standard output is NOT connected to a terminal echo hi.
It will print "hi" when there is no terminal (e.g. from "cron" or "at").
Quick test if you have permissions to use "at":
at now
[ -t 0 ] || echo hi
ctrl/D
Result is in unix mail for the user submitting the "at" job.