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
Crontab/Perl piping magic [duplicate]
-
07-12-2021 - |
Frage
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!
Lösung
Andere Tipps
It's bourne shell syntax to associate file descriptor 2 (STDERR) with file descriptor 1 (STDOUT), in effect sending STDERR to /abs/path/two/my/script-log.txt
.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow