4259 links
  • Arnaud's links
  • Home
  • RSS Feed
  • Tag cloud
  • Login
search: tag:status tag:error tag:grep tag:code — newest first
  • regex - Bash: One-liner to exit with the opposite status of a grep command? - Stack Overflow

    La commande eb d'amazon retourne toujours 0 même quand elle foire.. pas pratique pour repérer une erreur dans les script de CI..

    Mes scripts bash commencent tous avec "set -e" pour sortir en erreur des qu'il y a un probleme

    La commande eb me pose donc problème, j'ai fixé ça de cette mainère en attendant de trouver mieux :

    eb blablabla 2>&1 | ( ! grep ERROR)

    De cette manière, si dans le stdout ou dans le stderr on trouve 'ERROR', le grep va matcher et renvoyer 1 (dans une utilisation normale, grep retourne 0 si il match, mais avec le point d'exclamation, on inverse ce retour)

    Ce qui aura pour effet de passer mon script en erreur !

    January 4, 2017 - permalink - http://stackoverflow.com/questions/15367674/bash-one-liner-to-exit-with-the-opposite-status-of-a-grep-command
    code error exit grep status