Fish:该用户无法执行该文件

Fish:该用户无法执行该文件

我做了鱼功能~/.config/fish/functions/confgit.fish

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

但是当我运行这个函数时它只是说:

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

配置文件是普通的 Python 脚本。如果我运行它,./confgit它可以正常运行。

脚本的权限有:

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

我该如何解决这个问题以便我可以使用这个功能?
谢谢你的帮助

答案1

我努力重现你的问题,我可以模仿的最接近的是:

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

janstest It works!

和文件权限为:

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

当我运行它时,我收到类似的错误:

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]>

#!/usr/bin/fish解决方案是在脚本前面添加。

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

janstest It works
stew@stewbian ~> ~/bin/janstest2
It works

相关内容