【发布时间】:2015-01-08 18:42:16
【问题描述】:
我目前正在尝试运行
atom editor
在bash 外壳中,来自fish 外壳。由于 ide-haskell 如何处理 ghc-mod 路径解析以及其他一些标准化问题,我在 bash 中运行 atom 很重要。
这是我的做法:
#~/.config/fish/config.fish
function start-atom
bash $HOME/lib/atom/bin/Atom/atom $argv
end
但是,当我尝试从 fish 运行 start-atom 时,出现以下错误:
/home/athan/lib/atom/bin/Atom/atom: /home/athan/lib/atom/bin/Atom/atom: cannot execute binary file
即使我知道这个文件是正确且可执行的。有任何想法吗?谢谢!
【问题讨论】:
-
atom的 shebang 是什么?如果它以#!/bin/bash开头,无论如何都会用bash 运行。 -
...相反,如果您依赖于通过
~/.bashrc、~/.bash_profile等添加的功能,那么您将无法通过您正在做的事情获得这些功能无论如何,因为这些只是为 interactive shells 提供的。 -
(关于一个完全不同的主题——shell 函数和别名具有非常不同的语义;函数不是别名的子类型)。
-
@Charles,在fish中,别名是作为函数实现的。
alias foo bar变成function foo; bar $argv; end -
@glennjackman,使别名成为一种函数,而不是使函数成为一种别名。
标签: bash executable fish