STRING-REPEAT(1)
π¦ string-repeat(1) β the fish-shell girlies' guide to multiplying strings π
okay so bestie, you know how the string command is basically the main character of fish-shell? this is one of her little subcommands, and it lives in the fish-shell manual. we're talking string repeat β the multiply-a-string girlie. let's get into it β¨
πΈ SYNOPSIS πΈ
string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [-N | --no-newline]
[-q | --quiet] [STRING ...]
string repeat [-N | --no-newline] [-q | --quiet] COUNT [STRING ...]
two whole forms, no cap. pick whichever vibe fits π«Ά
π DESCRIPTION π
So here's the tea: string repeat takes your STRING and justβ¦ repeats it. -n or --count times. that's it, that's the gig π
Then there's -m or --max β that one caps how many characters get outputted (and no, the newline does not count toward that total, she's excluded from the math π). You can run --max all by itself or team it up with --count. and when both of them show up to the party together? here's the rule, bestie, listen close:
- max chars get outputted unless the final repeated string size is less than max β and in that case, the string keeps repeating until
counthas been reached.
Both --count and --max are totally fine with any number greater than or equal to zero. and if you pass zero? nothing gets outputted. literally nothing. ghost town π
oh and this part is important: the first argument is interpreted as COUNT if --count or --max are not explicitly specified. so watch out β that first arg is doing double duty depending on what flags you brought π
and if you throw in -N or --no-newline, the output won't have that newline character hanging off the end. tiny detail, huge slay.
Exit status: 0 if the yielded string is not empty, 1 otherwise. she's honest about it π
also, real talk β -q and --quiet are chilling right there in the synopsis, iykyk π§
β¨ EXAMPLES β¨
π Repeat Examples π
watch the icon do her thing:
>_ string repeat -n 2 'foo '
foo foo
>_ echo foo | string repeat -n 2
foofoo
>_ string repeat -n 2 -m 5 'foo'
foofo
>_ string repeat -m 5 'foo'
foofo
>_ string repeat 2 'foo'
foofoo
>_ string repeat 2 -n 3
222
see that last one? 2 as the string, -n 3 as the count, and boom β 222. that first-argument-as-COUNT rule really said "not today" when -n is already in the building ππ₯
π Copyright π
fish-shell developers β that's the crew behind all this β¨
and that's the whole page, bestie π we did it. this one's from fish-shell 4.9, dated Sep 08, 2026 β go forth and repeat responsibly, mwah ππ«Άπ
π¦ where this page comes from
- arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms