1

I made fish function in ~/.config/fish/functions/confgit.fish:

function confgit
    /home/john/Projects/confgit $argv
end

But when I run this function it just says:

fish: The file “/home/john/Projects/./confgit” is not executable by this user  
    /home/john/Projects/./confgit $argv  
    ^  
in function 'confgit'

The config file is normal python script. If I run it by ./confgit it runs fine.

There are the permissions of the script:

-rwxr-xr-x  1 john john 5.8K 29. nov 02.04 confgit*

How can I fix this so I can use this function ?
Thank you for help

5
  • 2
    Can you list or screenshot the permissions on the file for us? Nov 29 '20 at 9:32
  • @MarkScheck I have added permission info to question. Thank you for your reminder Nov 29 '20 at 10:58
  • 3
    Does john run this function or is it run by a service?
    – Stewart
    Nov 29 '20 at 11:34
  • @Stewart The whole point of this function is that I would be able to run confgit script from anywhere. So this command will be exclusively run in terminal by me(user john). Nov 29 '20 at 12:54
  • 1
    What is the shebang line in /home/john/Projects/confgit? Nov 29 '20 at 21:54
3

I worked to reproduce your problem, and the closest thing I could emulate was this:

# file: ~/bin/janstest
echo $argv
# file: ~/bin/janstest2
function janstest
  ~/bin/janstest $argv
end

janstest It works!

and file permissions as:

stew@stewbian ~> ls -l ~/bin/jans*
-rwxr-xr-x /home/stew/bin/janstest*
-rwxr-xr-x /home/stew/bin/janstest2*

When I run it I get a similar error:

stew@stewbian ~> ~/bin/janstest2
Failed to execute process '/home/stew/bin/janstest2'. Reason:
exec: Exec format error
The file '/home/stew/bin/janstest2' is marked as an executable but could not be run by the operating system.
stew@stewbian ~ [125]>

The solution was to prepend #!/usr/bin/fish to the the script.

stew@stewbian ~> cat ~/bin/janstest2
#!/usr/bin/fish
function janstest
  ~/bin/janstest $argv
end

janstest It works
stew@stewbian ~> ~/bin/janstest2
It works
2
  • Thank for your answer Nov 29 '20 at 15:35
  • 1
    I hope it helps. If it doesn't, see if you can make a skeleton script to emulate the problem. If you can't reproduce, figure out the difference between your skeleton and your actual script.
    – Stewart
    Nov 29 '20 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.