How to redirect the import log to /dev/null?

Hi
i am running oracle database import through a script and script scans the import log to see if there are any errors.

Now the porblem is that when i run the script the import log appears on the screen even if i direct the output of import to /dev/null.

imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par > /dev/null

i tried adding 2>&1 > /dev/null to the end but then the log appears in the log file instead of the screen ,which the script builds with

exec > ${RUN_PATH}/db_exp_full.log

i dont want the log either on the screen or the log file.I will just scan the log file for errors ,if any, mentioned in the log parameter of imp above.

Any ideas?

imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par > /dev/null

It should be added like this:

imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par >/dev/null 2>&1

Yup it worked but could you please expalin how.

Alright, so here is how error redirection works..

As you know, to send the STDOUT to /dev/null you do something like this: somecmd > /dev/null

So, to send STDERR to the same place, you can do:
somecmd 2> /dev/null

To send both STDOUT and STDERR to /dev/null you can do:
somecmd > /dev/null 2>&1

the 2 is writing to the same place that 1 is (which is dev null).. The &1 means "Whatever 1 is writing to".

Hopefully that explains it a bit better. :slight_smile:

Redirect any (error or ...) message [2] to standard output [1] as standard output went to /dev/null... So syntax is cmd cmd...>file 2>&1 (As for crontab lines: either you redirect in 2 separate files or you >toLogfile 2>&1 )

thanks everyone...