Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

last command in script

Status
Not open for further replies.

rrrirvine

MIS
Oct 19, 2001
7
US
Hi..

Anyones help be greatly appreciated.

In following two scripts :

last | grep "$MONTH $DAY" > /tmp/$LOGFILE1 2>&1

and

ftp -n -i << EOF > /dev/null 2>&1

Where,

$MONTH, $DAY & $LOGFILE1 are defined variable.
Now what does &quot;2>&1&quot; does ?
please explain.

Regards.
 


2>&1

redirects FILE Descriptor 2 ( STDERR) to File Descriptor 1 ( STDOUT ) thus basically also directing STDERR into the /tmp/$LOGFILE1

Just for completeness...

> file and 1> file

both mean redirect STDOUT and knowing that makes understanding

2>

easier.

File Descriptor 0 is STDIN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top