mit-scheme — run a script and exit

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:40:46

For Unix mit-scheme reads the input files via redirection:

mit-scheme < /usr/cph/foo.in > /usr/cph/foo.out 2>&1 &

This is taken from the documentation http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/Command_002dLine-Options.html#Command_002dLine-Options

Charlie Forthmount

Just let our command close stdin of the mit-scheme process automatically, e.g.

echo | mit-scheme --load sample.scm

We can expand it to a script function; here's my unskilled implementation:

function mschm () {
   IFS=""
   for arg in $@
       do
           echo | mit-scheme --load $arg
       done
}

You can add the --quiet argument to the mit-scheme command to suppress the default output. This is otherwise a crib of Charlie Forthmount's function (though it only loads one file):

run-mit-scheme () 
{ 
    echo | mit-scheme --quiet --load $1;
    # Add an extra newline
    echo
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!