Capture Scala Terminal Output
Often, when I am doing random coding on the scala terminal, I wish I could save it and be able to see to what I was doing later on. It would even help, if I made a discovery of doing something special and then be able to refer back to it. I could not find a way to do this in Windows command prompt (if anyone out there knows how to, I would highly appreciate that). If you have a Linux/Unix machine it is easier to do that. If you have Windows, like I do, install Cygwin. I often use the Cygwin bash over the Windows cmd (command prompt). Here is how I do it. I learned this from my introduction to programming language class.
- Before you type “scala” and hit Enter. Type this in your terminal (some refer to it as shell): script output_filename
- Thereafter begin your Scala terminal
- Do Scala programming until you are ready to quit
- Enter the “exit” command to exit the Scala terminal
- Enter “exit” one more time to exit your script
- cat output_filename to view your scala output