我在我的电脑上运行Ubuntu 14.04,我试图创建一个自定义别名,以便我可以运行ghc(Haskell编译器)。 我试图编辑.bash_aliases文件并添加命令:在ubuntu中创建自定义别名失败14.04
alias ghci1 = 'GHC_HOME=$HOME/Development/bin/ghc'
alias ghci2 = 'PATH=$GHC_HOME/bin:${PATH}'
alias ghcis = 'ghci'
这样做的整点是因为我安装了GHC 7.8.3,每次我想打开ghci的我要记下前两命令,否则我得到ghc没有安装在我的电脑上的错误。
当我打开已经编辑.bash_aliases文件,我得到消息后,一个终端:
bash: alias: ghci1: not found
bash: alias: =: not found
bash: alias: ghci2: not found
bash: alias: =: not found
bash: alias: ghcis: not found
bash: alias: =: not found
bash: alias: ghci: not found
bash: alias: ghci1: not found
bash: alias: =: not found
我在做什么错?我甚至试过这个命令:
。 〜/ .bashrc
只是为了防止.bash_aliases文件有问题,但我得到相同的错误信息。
而且当我在命令alias
型我得到的结果与其他别名此相伴:
alias GHC_HOME='$HOME/Development/bin/ghc'
alias PATH='$GHC_HOME/bin:${PATH}'
所以我的别名没有得到我分配给他们的名字。有没有办法以某种方式逃避'='字符或类似的东西这样的工作?
P.S.我用来安装GHC 7.8.3本指南是这样的:
https://gist.github.com/yantonov/10083524
那么,有没有可能安装GHC 7.8.3更好的办法,还是我在一个错误的方式来进行分配的别名?
谢谢。
做@ @ ChrisDrost答案所说的。你不应该试图通过别名来设置环境变量。 – thermite 2014-10-28 15:06:00