New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string repeat does not process beyond the first argument #5988
Comments
What is "consistently" here? Would it repeat each element n times, for "a a bb bb ccc ccc dddd dddd", or go through the list n times, for "a bb ccc dddd a bb ccc dddd"? Or something else?
What do you mean by this? You mean "print the variable, one line per element"? That's typically done via |
If I understand correct, all (other than repeat) string commands handle multiple arguments equivalent to So "consistent" repeat should return "aa bbbb cccccc dddd". |
Oops. "aa bbbb cccccc dddddddd". |
By the way, I tried "printf %s\n $var" to print variable, one line per element. And in my opinion this is not a good solution, because it prints one empty line when
|
You might like |
In 7a0bddf we repeat each argument in turn. |
Fish version 3.0.2
OS: Debian Linux
string commands handle multiple arguments, e.g., "string length a bb ccc dddd" return four elements 1 2 3 4.
It looks like string repeat is an exception here.
~> string repeat -n 2 a bb ccc dddd
aa
It would be better if string repeat handles multiple arguments consistently with the other string commands.
(My motivation here is to use "string repeat -n 1 $var" as a way to return array $var. Currently one can either manually loop and echo, or use "string join \n $var", but loops are too long, and string join feels like it returns a single element, and automatic unpacking via newline split feels weird. I feel string repeat could be a good alternative to these.)
The text was updated successfully, but these errors were encountered: