Question about fish shell initialization settings...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about fish shell initialization settings...

Carlo Tambuatco
I installed the fish shell from mp a few days ago, and I’ve been loving it so far, but
I’ve been wondering about where certain environment variables get set on startup…

On starting the shell, (within zsh at the moment, because fish isn’t yet my default
shell, since I am only just now learning it), it already seems to know all of the
environment variables eg: $PATH, $CPATH, $CLASSPATH, etc, that I set
from within the zsh initialization files. Is it reading my zsh initialization files to
get that information, or or getting that information from some other source?

When I finally switch to fish as a default shell do I need to write those
environment variables into a fish config file for fish to find it, or will it somehow
find it on its own? I’ve read the fish documentation, and it isn’t totally clear
on this point.
Reply | Threaded
Open this post in threaded view
|

Re: Question about fish shell initialization settings...

Bill Cole
On 22 Feb 2021, at 12:36, Carlo Tambuatco wrote:

> On starting the shell, (within zsh at the moment, because fish isn’t
> yet my default
> shell, since I am only just now learning it), it already seems to know
> all of the
> environment variables eg: $PATH, $CPATH, $CLASSPATH, etc, that I set
> from within the zsh initialization files. Is it reading my zsh
> initialization files to
> get that information, or or getting that information from some other
> source?

Environment variables are passed from parent processes to their
children. That's why they are called "environment" variables. A shell
also has variables that exist for its own use in command lines that are
NOT part of the environment. You can see all shell variables using the
'set' command and all environment variables with the 'env' command. You
can turn a normal variable into an environment variables with 'export
VARIABLENAME' and POSIX-compliant shells can also be configured to
export all variables automatically.

TL;DR: you'll need shell init files for fish.

--
Bill Cole
[hidden email] or [hidden email]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire