2017-09-23 81 views
1

假设您在/path/to/script.sh中定义了bash_function,并且您希望快速使用此GHCi。以下不工作:GHCi采购Bash文件?

Prelude> :!source /path/to/script.sh 
Prelude> :!bash_function 

有没有办法加载GHCI的bash的状态,使用户可以执行非股票外壳的功能呢?

回答

4

你不能保持状态身边,但你可以这样做:

:!source /path/to/script.sh && bash_function 

如果有你用了很多特定的脚本,你可以添加一个命令你~/.ghci,使这个更方便;例如

:def fun Prelude.return Prelude.. (":!source /path/to/script.sh && "Prelude.++) 

将使您在ghci中使用这个来代替:

:fun bash_function