Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run fish scripts #4084

Closed
Limeth opened this issue May 31, 2017 · 3 comments
Closed

Cannot run fish scripts #4084

Limeth opened this issue May 31, 2017 · 3 comments
Labels

Comments

@Limeth
Copy link

Limeth commented May 31, 2017

fish version: 2.5.0
Ubuntu 16.04 Linux limebox 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Hello, I can't seem to be able to run fish scripts, when I create an executable file echo "echo test" > script.fish, running fish ./script.fish results in an error message: ./script.fish: No such file or directory.

It works fine with sh -c 'env HOME=$(mktemp -d) fish', for some reason.

link/.config/fish $ tree
.
├── completions
│   ├── fisher.fish
│   ├── get.fish -> /home/limeth/.config/fisherman/get/completions/get.fish
│   └── git.fish -> /home/limeth/.config/fisherman/git-flow/completions/git.fish
├── conf.d
│   └── git-flow.init.fish -> /home/limeth/.config/fisherman/git-flow/init.fish
├── config.fish
├── fish_colors
├── fishd.limebox
├── fishfile
├── fish_history
├── fish_read_history
└── functions
    ├── cl.fish
    ├── fisher.fish
    ├── fish_greeting.fish -> /home/limeth/.config/fisherman/bobthefish/fish_greeting.fish
    ├── fish_mode_prompt.fish -> /home/limeth/.config/fisherman/bobthefish/fish_mode_prompt.fish
    ├── fish_prompt.fish -> /home/limeth/.config/fisherman/bobthefish/fish_prompt.fish
    ├── fish_right_prompt.fish -> /home/limeth/.config/fisherman/bobthefish/fish_right_prompt.fish
    ├── fish_title.fish -> /home/limeth/.config/fisherman/bobthefish/fish_title.fish
    ├── fish_user_key_bindings.fish
    ├── fzf_key_bindings.fish -> /home/limeth/.fzf/shell/key-bindings.fish
    ├── get.fish -> /home/limeth/.config/fisherman/get/functions/get.fish
    ├── getopts.fish -> /home/limeth/.config/fisherman/getopts/getopts.fish
    └── set_color_custom.fish -> /home/limeth/.config/fisherman/jellyfish/functions/set_color_custom.fish

3 directories, 22 files
$ cat config.fish
# Source dotfiles scripts
source ~/.dotfiles/bin/source.fish

# Enable terminal colors
set -x TERM "xterm-256color"

# Vi mode
# Automatically enable Vi mode in `~/.config/fish/functions/fish_user_key_bindings.fish`
set -g theme_display_vi yes

Link to ~/.dotfiles/bin/source.fish: https://gitlab.com/Limeth/dotfiles/blob/master/bin/source.fish

Any tips on what I should be looking for are appreciated.

@faho
Copy link
Member

faho commented May 31, 2017

running fish ./script.fish results in an error message: ./script.fish: No such file or directory.

This looks like something cds in your configuration.

Please try to run that file, and when it fails, run echo $PWD; fish -c 'echo $PWD'. If the two differ, that's your problem.

@Limeth
Copy link
Author

Limeth commented May 31, 2017

That was it!

$ echo $PWD
/tmp
$ fish -c "echo \$PWD"
/home/limeth

Thank you very much! :)

@Limeth Limeth closed this as completed May 31, 2017
@faho faho added the question label May 31, 2017
@krader1961
Copy link
Contributor

Right, your source.fish ends with cd ~. That's generally a bad idea. A login shell should already have PWD set to your home directory. And if you're starting any other fish instance you do not want to change the PWD. If you feel there is some good reason to do that you should limit it to interactive shells:

if status is-interactive
    cd ~
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants