+ Responder ao Tópico



  1. #1
    whinston
    Visitante

    Padrão OR em bash

    galera, estou igual barata tonta programa no google sobre apostila de bash onde de um exemplo de IF com OR e AND e não to achando

    como fz ?

  2. #2
    maverick_cba
    Visitante

    Padrão OR em bash

    E aí whinston, abaixo segue um local onde você vai encontrar o que procura.

    http://www.geocities.com/tipsforlinu...cles2/043.html

  3. #3
    whinston
    Visitante

    Padrão valeu!

    valeu !!!!!!!!!!!!!!!!
    ex.:

    and (logical)

    if [ $condition1 ] && [ $condition2 ]
    # Same as: if [ $condition1 -a $condition2 ]
    # Returns true if both condition1 and condition2 hold true...

    if [[ $condition1 && $condition2 ]] # Also works.
    # Note that && operator not permitted within [ ... ] construct.

    Note

    && may also, depending on context, be used in an and list to concatenate commands.
    ||

    or (logical)

    if [ $condition1 ] || [ $condition2 ]
    # Same as: if [ $condition1 -o $condition2 ]
    # Returns true if either condition1 or condition2 holds true...

    if [[ $condition1 || $condition2 ]] # Also works.
    # Note that || operator not permitted within [ ... ] construct.