-1

I want to log everything that appears on the screen. It's supposed to be something like a history file: I've made something like that but it doesn't work. I can't see what script is doing.

exec > output.txt 2>&1

echo "Hello"
echo "Alice"
echo "put something"
read input
echo $input

Thank you for any help.

terdon
  • 234,489
  • 66
  • 447
  • 667
  • `script &> output.log` ? Your `exec` redirect makes no sense if that's exactly what you're running. Read `man exec` for more details. – Artem S. Tashkinov Dec 21 '22 at 15:40
  • Thank for suggestion. I must put the redirection in file of script. I don't have big experience in bash so I copy it from stackover. Thank for suggestion. – Kris_Holder Dec 21 '22 at 15:45
  • Is this only for things that are shown in the terminal or do you want everything that appears "in the screen" including GUI? Are you just looking for this: [Save all the terminal output to a file](https://unix.stackexchange.com/q/200637) – terdon Dec 21 '22 at 16:19
  • Not at all. My script save logs to a file but I don't see the script running on the screen :(. I need to do something in this script to save logs in the file. – Kris_Holder Dec 22 '22 at 07:56

1 Answers1

0

I haven't found any useful information. I made something what is very ugly for me:

'''  echo "Hello"|&tee -a log.txt
     echo "Alice"|&tee -a log.txt
     echo "put something"|&tee -a log.txt
     read input
     echo &input|&tee -a log.txt

'''

Blockquote

Thank you for your help.