Crontab/Perl piping magic
Possible Duplicate:
In the bash shell, what is “ 2>&1 ”?
I recently saw this in a crontab:
5 * * * * perl /abs/path/to/my/script.pl >> /abs/path/two/my/script-log.txt 2>&1
If I'm reading this correctly, it runs script.pl
every hour, 5 minutes after the hour (so 2:05, 3:05, 10:05, etc.). Again, if I'm correct, it is redirecting standard output to a log file located elsewhere.
But what is this Linux/Perl voo-doo at the end of the crontab?
2>&1
What is this instructing Linux/Perl to do? And if my above interpretation of the crontab is incorrect, please clarify for me as well! Thanks in advance!
Redirect file descriptor 2 (stderr) over 1; it's the idiomatic way to tell /bin/sh that stderr should go in the same place as stdout
它是将文件描述符2(STDERR)与文件描述符1(STDOUT)相关联的bourne shell语法,实际上是将STDERR发送到/abs/path/two/my/script-log.txt
。
上一篇: 如何理解这个重定向命令?
下一篇: Crontab / Perl管道魔法