SOURCE(1)
π SOURCE(1) β the fish-shell girlies' guide π
okay so this is source, bestie, straight out of the fish-shell manual and it's genuinely iconic. let's get into it π«Ά
β¨ NAME β¨
source β evaluate contents of file. that's it. that's the vibe. π
πΈ SYNOPSIS πΈ
source FILE [ARGUMENTS ...]
SOMECOMMAND | source
. FILE [ARGUMENTS ...]
three whole ways in, and yes one of them is on the deprecated list, we'll get there, don't worry π
π¦ DESCRIPTION π¦
okay so source evaluates the commands of the specified FILE inside the current shell, as a brand new block of code. and this is the key part, the main character detail: it is not the same as spinning up a whole new process to run the commands (like, say, fish < FILE), because the commands get evaluated by the current shell. which means changes to shell variables will actually affect the current shell. no spawning, no ghosting, no separate little universe. it's giving "we're all in the same shell together" π
if you throw extra arguments in after the file name, they get inserted into the argv variable. and no, the argv variable will not include the name of the sourced file. so cute of it. β¨
fish will search the working directory to resolve relative paths, but it will not search PATH. ngl this trips people up, so like, keep that in mind π«Ά
if you pass no file and a file or pipeline is connected to standard input β or if the file name is just - β then source will read from standard input. but if no file is specified and there's no redirected file or pipeline sitting on standard input? yeah, an error gets printed. sorry bestie, it needs something to chew on π
the exit status of source is the exit status of the last job to execute. and if something goes wrong while opening or reading the file, source exits with a non-zero status. so like, check your exit codes, it's the respectful thing to do π
okay now the history lesson: some other shells only support the . alias (a single period β yes, one, a whole period). but the use of . is deprecated in favour of source, and . will be removed in a future version of fish. so like, don't get attached. it's giving "you had a good run" π
one more thing and this one actually matters: source creates a new local scope. so a set --local inside a sourced block will not affect variables in the enclosing scope. it stays in its own lane, respectfully. π§
and for the people in the back who just want help: the -h or --help option displays help about using this command. that's the whole feature. use it. π
β EXAMPLE β
source ~/.config/fish/config.fish
# Causes fish to re-read its initialization file.
literally the classic. re-reading the init file, the "have you tried turning it off and on again" of fish. ate. π₯
π Copyright π
fish-shell developers π
and that's the whole page, bestie! this was SOURCE(1), from the fish-shell manual, version 4.9, dated Sep 08, 2026. go source something iconic today, and remember: . is on borrowed time π
β¨πΈ
π¦ 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