8000 string split returns empty array when all elements are empty · Issue #5987 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

string split returns empty array when all elements are empty #5987

@ssjhv

Description

@ssjhv

Fish version 3.0.2
OS: Debian Linux

"string split" has explicit option (-n or --empty) to whether return empty elements or not. This works as intended, usually.

~> count (string split / a/)
2
~> count (string split / /a)
2
~> count (string split -n / a/)
1
~> count (string split -n / /a)
1

However, there is an edge case

~> count (string split / /)
0
~> count (string split -n / /)
0

And the returns non-zero status. This feels somewhat inconsistent with the other cases.

  • With -n or not, the returned status should be zero, because there was a split.
  • The invocation without -n (string split / /) should return array of two empty strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0