Posts

Showing posts with the label системное администрирование

Перенаправление вывода в linux(unix) - Output redirection in linux(unix)

Image
  echo test > afile . txt ..redirects stdout to afile.txt . This is the same as doing.. echo test 1> afile . txt To redirect stderr, you do.. echo test 2 > afile . txt >& is the syntax to redirect a stream to another file descriptor - 0 is stdin. 1 is stdout. 2 is stderr. You can redirect stdout to stderr by doing.. echo test 1 >& 2 # or echo test >&2 ..or vice versa: echo test 2 >& 1 So, in short:  2> redirects stderr to an (unspecified) file, appending &1 redirects stderr to stdout In the shell, what does “ 2>&1 ” mean?   Crontab, want to mail just errors to myself AND log output in separate file Some additional INFO: Основы системного администрирования Linux: работа с консолью Техническая библиотека IBM - Linux 101 Перенаправление вывода (википедия) Перенаправление ввода/вывода, каналы и фильтры в BASH Что значит >/dev/null 2>&1 Advanced Bash-Scripting Guide and little add...