fish_add_path in config.fish: The expanded command was empty when trying to add to PATH - Stack Overflow

Hello I want to use FISH as my main shell and I have to prepend some directoriesfiles to $PATH. I foll

Hello I want to use FISH as my main shell and I have to prepend some directories/files to $PATH. I followed the guide on the ArchLinux wiki for prepending to $PATH but I ran into issues. This is the error message, I get it every time I start my Shell. But I can still use it afterwards:

~/.config/fish/config.fish (line 1): The expanded command was empty. $fish_add_path -p /usr/bin/fish ~/.bash.profile /ect/bash.bashrc ~/.bashrc /usr/local/texlive/2024/x86_64-linux ^~~~~~~~~~~~~^ from sourcing file ~/.config/fish/config.fish called during startup

And what I have written in my config.fish is: $fish_add_path -p /usr/bin/fish ~/.bash.profile /ect/bash.bashrc ~/.bashrc /usr/local/texlive/2024/x86_64-linux

I'm using Manjaro I3 and fish version 4.0.0.

I already tried to type this command in the terminal, it didn't work though: set -U fish_user_paths; /usr/local/bin $fish_user_paths

And in most other cases people were using old fish versions and when they updated their FISH shell it worked.

Hello I want to use FISH as my main shell and I have to prepend some directories/files to $PATH. I followed the guide on the ArchLinux wiki for prepending to $PATH but I ran into issues. This is the error message, I get it every time I start my Shell. But I can still use it afterwards:

~/.config/fish/config.fish (line 1): The expanded command was empty. $fish_add_path -p /usr/bin/fish ~/.bash.profile /ect/bash.bashrc ~/.bashrc /usr/local/texlive/2024/x86_64-linux ^~~~~~~~~~~~~^ from sourcing file ~/.config/fish/config.fish called during startup

And what I have written in my config.fish is: $fish_add_path -p /usr/bin/fish ~/.bash.profile /ect/bash.bashrc ~/.bashrc /usr/local/texlive/2024/x86_64-linux

I'm using Manjaro I3 and fish version 4.0.0.

I already tried to type this command in the terminal, it didn't work though: set -U fish_user_paths; /usr/local/bin $fish_user_paths

And in most other cases people were using old fish versions and when they updated their FISH shell it worked.

Share edited Mar 7 at 16:23 NoelR0 asked Mar 7 at 16:11 NoelR0NoelR0 214 bronze badges 1
  • What did you do exactly? What are the error messages you received? Please put those as text into your question, not as linked images. – Ulrich Eckhardt Commented Mar 7 at 16:18
Add a comment  | 

1 Answer 1

Reset to default 1

There are multiple issues here.

The first: You copied the command wrong.

When documentation like https://wiki.archlinux./title/Fish shows a $ at the beginning of a line, that's usually meant to be the prompt symbol. It is not part of the command you should run, but a representation that you should ignore when copying.

So you ran

$fish_add_path -p ...

when you should have run

fish_add_path -p ...

without the $. The $ causes fish to interpret it as a variable, and there is no variable by that name. So it tells you that it's empty and so it doesn't have a command to run.

----

The second issue: The paths you are passing here are not paths you want to add to $PATH.

/usr/bin/fish ~/.bash.profile /ect/bash.bashrc ~/.bashrc /usr/local/texlive/2024/x86_64-linux

"/usr/bin/fish" is the fish executable. $PATH contains directories, not files, and /usr/bin will already be included (or your system is super borked).

~/.bash.profile is a misspelling of ~/.bash_profile, and that is also a file, and it is a bash configuration file, so adding that to $PATH makes no sense - that's not how $PATH works. Same with "/ect/bash.bashrc" (which would be /etc/bash.bashrc) and ~/.bashrc.

/usr/local is most likely already included. It won't really harm to include it here, I suppose.

/usr/local/texlive/2024/x86_64-linux might be an actual directory that might make sense to add.

----

You should read up on what $PATH does and is, and figure out what exactly you want to achieve by adding .bash_profile and bashrc to it.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744918515a4600984.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信