For an assignment, I need to run a few commands in the terminal and save the entire session - both the output and commands - to a text file. Piping the Command Prompt commands saves only the output; in a Linux terminal I'd use the "script" command, but git-bash cannot find this command.
Since script command is available for Linux. Windows Command Prompt does not have script command. Git-Bash is also modified and formatted form of Windows Command Prompt so it also does not have script command. To have it Login to Linux machine from Git-Bash and proceed as per instruction. So to use script command:
- Either Login to a Linux Machine and run the script command and then run the command you need to run.
- Or do a ssh login on to a remote Linux Machine from Git-Bash and proceed further.
If want to same behavior on Windows:
- Write equivalent batch script for windows command prompt. By default command prompt first echo the command and then its output unless you use @echo off at the first line of batch script.
- Find a windows version of script command if someone have taken the pain to write for you still the command run on Linux can not be fully available on windows.