in reply to Re^4: system function adds spurious characters to log file
in thread system function adds spurious characters to log file
The -t test checks if STDIN is coming from a tty or not, similar to POSIX::isatty. When you invoke your shell script automatically, redirect STDIN from /dev/null. Like this:
$ cat test.sh #!/bin/sh perl -le 'print "Interactive" if -t' perl -le 'print "Batch" unless -t' $ sh test.sh Interactive $ sh test.sh </dev/null Batch
|
|---|