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, the status env 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 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