input and returning the input: output. Here is the assignment
In the session, provide a command prompt that includes the working directory, e.g., $./logger /home/it244/it244/hw8$
Accept user’s commands, execute them, and display the output on the screen.
During the session, create a temporary file “PID.cmd” (PID is the process ID) to store the command history in the following format (index: command):
2: ls -l
If the script is aborted by CTRL+C (signal 2), output a message “aborted by ctrl+c”.
When you quit the logging session (either by “exit” or CTRL+C),
a. Delete the temporary file
b. Print out the total number of the commands in the session and the numbers of successful/failed commands (according to the exit status).
here is my code so far (which did not go well, I would not try to run it)
#!/bin/sh trap 'exit 1' 2 trap 'ctrl-c' 2 echo $(pwd) while true do read -p command echo "$command:" $command >> PID.cmd done