Permissions
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*
我該如何解決這個問題,以便我可以使用這個功能?
謝謝你的幫助
我努力重現你的問題,我能效仿的最接近的是:
# 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