In a shell script, I want to 'spool' (record) the shell prompt & command typed alongwith its output into a file.
In the script, if I give a 'ls' command, the file should contain:
<<root@server ~>>$ ls a b c.txt <<root@server ~>>$
i.e. the command as if issued on the shell followed by its output.
Any ideas on how to accomplish this? Tried using the 'script' command but to no use.