fish-shell / fish-shell

The user-friendly command line shell.

Home Page:https://fishshell.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation: `export` works fine

guettli opened this issue · comments

I read this part of the documentation: https://fishshell.com/docs/current/language.html#exporting-variables

I never used fish, and I use Bash since 20 years.

After reading your documentation about exporting variables I thought that it does not make sense to try out fish.

My concern: We use direnv to export variables. The .envrc files contain export FOO=$HOME...

But everything is fine. Fish supports export.

Please extend the documentation, so that new users know that export works, too.

.envrc is sourced using /bin/sh, not fish. It looks like it does because direnv computes a diff of the environment and applies that to the host shell

Maybe, but export works, and this is great. Otherwise I would not be able to use Fish.

❯ echo $SHELL
/usr/bin/fish

❯ export FOO=abc-$HOME

❯ echo $FOO
abc-/home/guettli

# checking that the env var exists in sub processes:
❯ bash

❯ echo $FOO
abc-/home/guettli

Just ignore my comment about direnv. I think adding the support for export to the docs makes sense.

If you disagree, not big problem, just close this issue. I just wanted to you to know what I think.

export foo=bar works because fish ships a compatibility function.

That has a few limitations, and in general we want to emphasize set, because that's easier to learn because it has all the variable manipulation in one place.

I do not believe we want to make export more prominent in the documentation.