Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
Source project has a limited visibility.
  • Stephen Warren's avatar
    4c80f29e
    cmd_test: check for binary operators before unary · 4c80f29e
    Stephen Warren authored
    
    This better mirrors the behaviour of bash, for example:
    
    $ if test -z = -z; then echo yes; else echo no; fi
    yes
    
    This is parsed as a string comparison of "-z" and "-z", since the check
    for the binary "=" operator occurs first. Without this change, the
    command would be parsed as a -z test of "-", followed by a syntax error;
    a trailing -z without and operand.
    
    This is a behavioural change, but I believe any commands affected were
    previously invalid or bizarely formed.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
    4c80f29e
    History
    cmd_test: check for binary operators before unary
    Stephen Warren authored
    
    This better mirrors the behaviour of bash, for example:
    
    $ if test -z = -z; then echo yes; else echo no; fi
    yes
    
    This is parsed as a string comparison of "-z" and "-z", since the check
    for the binary "=" operator occurs first. Without this change, the
    command would be parsed as a -z test of "-", followed by a syntax error;
    a trailing -z without and operand.
    
    This is a behavioural change, but I believe any commands affected were
    previously invalid or bizarely formed.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>