Skip to content

interp: some binary tests should use space trim before atoi #928

Closed
@ihar-orca

Description

It seems that the Bash trims spaces before integer comparison:

> if [ " 14 " -lt "22" ]; then  echo "true"; fi
< true

> if [ " 14 " -eq "14" ]; then  echo "true"; fi
< true

The sh/interp uses strict comparision rules and does not use any space trim functions before the binary tests that are defined in interp/test.go (binTest func, atoi).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions