NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/39446: /bin/sh: test <NUMBER> <op> <NUMBER> improvements



>Number:         39446
>Category:       bin
>Synopsis:       /bin/sh: test <NUMBER> <op> <NUMBER> improvements
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 01 10:55:00 +0000 2008
>Originator:     Aleksey Cheusov
>Release:        NetBSD-4
>Organization:
home
>Environment:
have no access right now.
>Description:
Built-in test command shows the warning if arguments of -eq, -ne etc.
operators are not numbers but doesn't if arguments are an empty string.

  0 ~>/bin/sh -c 'test 1 -eq 1'  
  0 ~>/bin/sh -c 'test 1 -eq a' 
  test: a: bad number
  2 ~>/bin/sh -c 'test a -eq 1' 
  test: a: bad number
  2 ~>/bin/sh -c 'test "" -eq 1'
  1 ~>

I propose to display a warning and make an exit status
equal to 2 in the latter case too. bash and dash works this way.
And I think it is useful for debugging.

The same for NetBSD /bin/test command

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index