I am a beginner to the unix scripts, can anyone please explain what does the below lines mean:
BTEQTEMPDELLOGS=$LOGS/${tablename}.DELlog
rm $BTEQTEMPDELLOGS 2>/dev/null 1>/dev/null
I am a beginner to the unix scripts, can anyone please explain what does the below lines mean:
BTEQTEMPDELLOGS=$LOGS/${tablename}.DELlog
rm $BTEQTEMPDELLOGS 2>/dev/null 1>/dev/null
The rm ("remove") command removes a file. The name of the file to be removed is given in a variable BTEQTEMPDELLOGS, instead of directly. Any error messages (2>) by rm are sent to /dev/null (thrown away), the same for normal output (1>).
The variable BTEQTEMPDELLOGS itself is constructed in your first line by concatinating the variable LOGS, a literal '/' and the variable tablename with the string ".DELlog" at the end.
Here is documentation on (input and) output redirection: GNU bash manual: Redirections.
In your example, only output is redirected, not input. 1> redirects the normal messages issued by rm (there usually are none), 2> redirects only the error messages (file not found etc.).
Here is more detailed information on these numbers ("file handles" from the programmer's point of view): stdin (0), stdout (1) and stderr (2) in-/output of programs.
Here is documentation on /dev/null: Wikipedia: NULL device