4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
    Type 1 or more characters for results.
    Links per page: 20 50 100
    page 1 / 1
    1 results tagged stderr x
    • Comment filtrer la sortie d'erreur (seulement)

      Prenons un bash qui ouput sur sa sortie standard (stdout) et sur sa sortie d'erreur (stderr) :

      cat test.bash

      echo good
      echo bad >&2
      echo vanish >&2
      echo good!

      Comment faire pour rediriger la sortie standard vers un fichier (ou /dev/null pour l'exemple) et filter la sortie d'erreur pour retirer la ligne "vanish" ?

      Pour ça il faut utiliser un process substitution :

      /root/test.bash 2> >(grep -v vanish >&2) >/dev/null

      Bien pratique dans un crontab pour recevoir un peu moins de mail lorsqu'on a des "erreurs" acceptables (rsync vanished par exemple)

      SHELL=/bin/bash

              • root /root/test.bash 2> >(grep -v vanish >&2) >/dev/null

      Pour en savoir plus sur les process substitution : http://tldp.org/LDP/abs/html/process-sub.html

      November 7, 2014 at 10:16:11 AM GMT+1 - permalink - archive.org - https://links.infomee.fr/?-D0dqQ
      cron crontab indirection redirection rsync stderr stdin vanish
    Links per page: 20 50 100
    page 1 / 1
    Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation