Redirecting the input output stream using the << symbol in the c or bash shell. This is useful when you wish to run another program that is initialized in the shell through a command.
Redirecting the input output stream using the << symbol in the c or bash shell. This is useful when you wish to run another program that is initialized in the shell through a command.
Date Created:Tuesday October 28th, 2008 08:51 PM
Date Modified:Tuesday January 19th, 2010 10:44 PM
This demonstrates usage using stk, the command to invoke a scheme prompt. Lets say we write a file my-stk:
stk << ENDCAT (load "$1") ENDCATThen chmod the file:
chmod +x my-stkThen edit your .cshrc, .bashrc, .profile or whichever you are using:
alias my-stk location-to-the-folder-my-stk-is-in/my-stkNow you are ready to call the command after starting a new terminal session:
my-stk somefile.scmThis will open up the scheme prompt, then load the file, then close the scheme prompt. It will print all output to the terminal. For stk in particular, we can keep the prompt open using a few methods: stk's preferred method:
stk -load somefile.scmUsing shell redirection and piping with stk's interactive flag:
cat somefile.scm - | stk -interactiveThe "cat somefile.scm -" combines the contents of somefile.scm and the standard input. To invoke the interactive read-eval-print loop, the interactive flag must be set.
