ssjhv · GitHub

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.

Read the original on github.com ↗