Skip to content

tr: Should not accept unaligned [:upper:] #6341

@BenWiederhake

Description

@BenWiederhake
$ echo -en '123456789' | tr -t "123456789" "[:upper:]"
tr: misaligned [:upper:] and/or [:lower:] construct
[$? = 1]
$ echo -en '123456789' | cargo run tr -t "123456789" "[:upper:]"
00000000  41 42 43 44 45 46 47 48  49                       |ABCDEFGHI|
00000009
$

Note that this really checks for alignment, not just presence:

$ echo -en '123abcABC' | tr -t "1[:lower:]" "[:upper:]_"
tr: misaligned [:upper:] and/or [:lower:] construct
[$? = 1]
$ echo -en '123abcABC' | cargo run tr -t "1[:lower:]" "[:upper:]_"
A23BCDABC

(Original issue: #6133)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions