RETURN(1)
β¨ RETURN(1) β¨
okay so bestie, this is the return page from the fish-shell manual and it's literally the shortest little baddie but it's so important. like, the whole personality of this command is "i'm done here, bye π" and honestly? relatable.
π NAME π
return β stop the current inner function
like yes, that's it, that's the whole job. it stops the function you're inside. iconic behavior. π
π¦ SYNOPSIS π¦
return [N]
that's it. one optional little number. we love a low-maintenance queen. π
πΈ DESCRIPTION πΈ
so return halts a currently running function. that's the vibe. it's giving "i have finished my tasks, i am leaving the group chat." π«Ά
the exit status gets set to N if you give it one β so you can be like "i'm leaving AND i'm leaving with a specific mood." π₯
now, plot twist π β if return is invoked outside of a function or dot script, it is equivalent to exit. so like, if there's no function to return from, it just straight up dips out of the shell entirely. no cap.
it's often added inside of a conditional block such as an if statement or a switch statement to conditionally stop the executing function and return to the caller. it can also be used to specify the exit status of a function. so it's not just a dramatic exit β it's also how you tell the caller "here's my final answer, bestie." π
other important return lore, listen up:
- if you're at the top level of a script, it exits with the given status, like
exit. yeets the whole script. bye. π - if you're at the top level in an interactive session, it will set
status(you know, thestatusenv var situation) but it will not exit the shell. so it's more of a vibe check than a goodbye. you're safe. breathe. π
and hey, the -h or --help option displays help about using this command β so if you ever forget any of this, the command will happily explain itself. self-aware king. π
β EXAMPLE β
okay so here's an implementation of the false command as a fish function β like, building false from scratch, which is such a slay little exercise:
function false
return 1
end
see what she did there?? return 1 β exits the function with status 1, which is exactly what false is supposed to do. ate. no notes. π
ngl bestie, the whole lesson here is: return stops the function you're in, and the number you hand it becomes the exit status. don't overthink it. π
π§ Copyright π§
copyright belongs to the fish-shell developers β respect the queens who built this. π
and that's the whole page, bestie!! this lil gem comes to you from version 4.9, dated Sep 08, 2026, part of the fish-shell manual set β now go forth and return with confidence πβ¨ππ¦πΈ
π¦ 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