command task script

ksh $CODE/dis/scripts/IS_BTEQ_LZ_TABLE_AUDIT.sh
DIS_BTEQ LZ_DIS_LOAD_LOG_KEY > $CODE/dis/logs/lz_table_audit_`date '+%Y%m%d_%H%M%S'`.log 2>&1

Can some one tell me what the above script is doing?

As per my understanding we are executing the script and sending the output to a log file. The log file will be created based on todays date and time stamp.

But can some one tell me in detail about the script. what does at the end 2>&1 mean?

I know only basic unix and we are using this script in Informatica.

Thanks in Advance.

echo is simple debug

echo "DIS_BTEQ LZ_DIS_LOAD_LOG_KEY > $CODE/dis/logs/lz_table_audit_`date '+%Y%m%d_%H%M%S'`.log 2>&1"

and 2>&1 means that redirect filehandler 2 to the same file as handler 1.
=> redirect stderr to the same file as stdout.

Would be really helpful if you can explain me in more detail.

I have understood what 2>&1 does but the remaining part is not clear.

Thanks

  • prog > file --> prog's stdoutput(">" is acutally eqauls to "1>") sends to file [ 1-->file])
  • 2>&1 --> prog's stderror sends to stdoutput (our stdoutput's is redirected to file at the above, resultly stderror also goes to file [ 2-->file])
  • prog > file 2>&1 --> means , send stdout and stderr to file [ 1 and 2--> file])

regards
ygemici

same as

$(date '+%Y%m%d_%H%M%S')

filename is constant + output of some command $( ).

In this case date command using date command format parameters. man date more.

date '+%Y%m%d_%H%M%S' 

You can use value of variable $variable and output of subprosess $(command) in your command line.