Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
Source project has a limited visibility.
  • Stephen Warren's avatar
    d9b651ce
    cmd_test: implement ! on sub-expressions · d9b651ce
    Stephen Warren authored
    
    Currently, ! can only be parsed as the first operator in an expression.
    This prevents the following from working:
    
    $ if test ! ! 1 -eq 1; then echo yes; else echo no; fi
    yes
    $ if test ! 1 -eq 2 -a ! 3 -eq 4; then echo yes; else echo no; fi
    yes
    
    Fix this by parsing ! like any other operator, and and handling it
    similarly to -a and -o.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
    d9b651ce
    History
    cmd_test: implement ! on sub-expressions
    Stephen Warren authored
    
    Currently, ! can only be parsed as the first operator in an expression.
    This prevents the following from working:
    
    $ if test ! ! 1 -eq 1; then echo yes; else echo no; fi
    yes
    $ if test ! 1 -eq 2 -a ! 3 -eq 4; then echo yes; else echo no; fi
    yes
    
    Fix this by parsing ! like any other operator, and and handling it
    similarly to -a and -o.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>