Q:

shell script + one single syntax command in the script to send errors to log

I have the test.ksh script
my question if it possible to define in the first of the script that all standard errors will go to /tmp/errlog file in place to put 2>/tmp/errlog after each command etc
second do not suggest  the option to put the ./test.ksh 2>/tmp/errlog isn't relevant
lida

A:

Try exec 2> /tmp/error.log.
From the manual:
exec [  -c  ] [  -a name   ] [  arg  . . .  ]
If
arg 
is given,
the command specified by
the arguments is executed in place of this shell
without creating a new process.
The
-c
option causes the environment to be cleared before applying
variable assignments associated with the
exec
invocation.
The
-a
option
causes
name 
rather than the first
arg,
to become
argv[0]
for the new process.
Input/output arguments may appear and
affect the current process.
If
arg 
is not given,
the effect of this command is to
modify file descriptors
as prescribed by the input/output redirection list.
In this case,
any file descriptor numbers greater than 2 that are
opened with this mechanism are closed when invoking
another program.

