Quote:
Originally Posted by
Ariean
I am missing something what do u mean by standard error? i understand standard output is the output printed on screen when i execute the script. But i didn't understand "2>&1" part, whats happening over there?
Thanks,
Ariean
By tradition, a UNIX process has three default streams: standard input(stdin), standard output(stdout), and standard error(stderr). stdin is represents the terminal keyboard as file descriptor 0, stdout represents the terminal screen as file descriptor 1, and stderr is also directed to the terminal screen as file descriptor 2.
The idea with having
two files going to the terminal is to keep data and error messages separate. You can redirect the data output of a process into a file and still see human-readable error messages on your terminal. It also helps keep error messages OUT of data files since other programs probably won't need or understand them.
Here they're redirecting both stdout and stderr into the data file, for better or for worse. The "2>&1" bit tells it to redirect FD 2, stderr, to the same destination as FD 1, stdout.