what does this command do?

Hi all,

I would like to know how this command works

exec </dev/console >/dev/console 2>&1

Also please pay particular attention to the syntax and i would like to know if the syntax is correct (particularly the spacing!!)
Am trying to debug a script at boot time and am not getting any errors so thought i would use this to figure out what's going wrong?

Thanks

What type of script are you trying to debug ?
Anything in the rc.log ??

well not an rc script in the technical sense, but its a boot up script that does all the loading of drivers and mounting FS from the cdrom to respective places....

Am actually working on a opensolaris distro.
And here the notion of rc scripts is obsolete ,its in the form of services and milestones!!!

could you shed some light on it now?

Sorry wrapster, never dealt with opensolaris.

Be patient, someone's bound to know and provide some light.

ok ,
No problem,thanks for taking interest

exec in this form is for redirecting the file descriptors of the process.

Think of it this way; if you always want to do "myscript 2>/tmp/fnord 1>&2" then you can say this inside myscript, right at the beginning:

exec 2>/tmp/fnord 1>&2

Then the redirections are no longer needed at the prompt when you run myscript.

So in your example, the script's input file descriptor (what every command will be reading from if not given a file argument -- read, cat, grep, you name it) from that point on is /dev/console, output from all commands will go to /dev/console (unless separately redirected, of course), and errors will go to the same (2>&1 means send standard error where-ever standard output is).