BREAK(1)
π NAME π
break β it stops the current inner loop, bestie. That's the whole assignment, and it ate. β¨
π¦ SYNOPSIS π¦
LOOP_CONSTRUCT
[COMMANDS ...]
break
[COMMANDS ...]
end
πΈ DESCRIPTION πΈ
Okay so picture this: you're chillin' inside a loop that's currently running β a LOOP_CONSTRUCT, like a for loop or a while loop β and you're like "girl, I need OUT of here right now." That's literally what break does. It halts the loop mid-vibe. π
Most of the time you're not just yeeting it in there raw, though β you tuck it inside a conditional block, like an if block, so it only bails when something specific happens. Main character energy only. π
Also, if you hit the -h or --help option, it displays help about using this command. Public service, honestly. π«Ά
π EXAMPLE π
So here's the scenario: we're searching all the .c files for "smurf", and we dip out at the first occurrence we find. No cap, first one and we're done. π
for i in *.c
if grep smurf $i
echo Smurfs are present in $i
break
end
end
See how the break lives inside the if? That's the move. It's giving "found my smurf, bye." π
π SEE ALSO π
- the
continuecommand β that one's for when you don't wanna leave the loop entirely, you just wanna skip the rest of the current iteration of the current inner loop. Different vibe, equally iconic. β
π Copyright π
fish-shell developers
and that's the tea, bestie β brought to you by fish-shell, version 4.9, dated Sep 08, 2026. go break out of a loop (responsibly) π π
π¦ 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