Skip to content

environment is not available when sourcing /etc/fish/config.fish #2391

Closed

Description

@Profpatsch

My problem: I’m trying to source files in an env variable.

For that I append the following to my /etc/fish/config.fish

    echo DEBUG
    env
    echo DEBUG2
    for p in $FISH_SOURCE_PATHS
      echo "sourced $p"
      source "$p"
    end

a file foo `echo "echo foo" > ~/foo

and call

~> env -i FISH_SOURCE_PATHS=/home/philip/foo fish
DEBUG
FISH_SOURCE_PATHS=/home/philip/foo
HOME=/home/philip
PATH=/usr/bin:/bin
PWD=/home/philip/nixpkgs
SHLVL=1
USER=philip
__fish_bin_dir=/nix/store/aq5yv3i6ln4w84y2ais5m2j5a6z0djsz-fish-2.2.0/bin
__fish_datadir=/nix/store/aq5yv3i6ln4w84y2ais5m2j5a6z0djsz-fish-2.2.0/share/fish
__fish_help_dir=/nix/store/aq5yv3i6ln4w84y2ais5m2j5a6z0djsz-fish-2.2.0/share/doc/fish
__fish_sysconfdir=/nix/store/aq5yv3i6ln4w84y2ais5m2j5a6z0djsz-fish-2.2.0/etc/fish
DEBUG2

It should print foo after DEBUG2.

Even a simpler command like for p in $EXISTINGVAR; echo "$p"; end does not print anything.
Interestingly, for $PWD this prints an empty line.

Activity

  1. ridiculousfish commented on Sep 15, 2015

    @ridiculousfish
    Member

    I can't reproduce on OS X with ToT fish. What is your OS and fish version?

  2. Profpatsch commented on Sep 15, 2015

    @Profpatsch
    Author

    Nixos, 2.2.0

  3. Profpatsch commented on Sep 15, 2015

    @Profpatsch
    Author

    Oh, should have looked at the generated result. :)
    It seems the generated code gets crippled.

  4. ridiculousfish commented on Sep 16, 2015

    @ridiculousfish
    Member

    Huh? What happened?

  5. Profpatsch commented on Sep 16, 2015

    @Profpatsch
    Author

    I forgot to escape $ and they got eaten by bash.

  6. ridiculousfish commented on Sep 16, 2015

    @ridiculousfish
    Member

    Ah-ha!

  7. locked as resolved and limited conversation to collaborators on Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions