-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.

4
  • script &> output.log ? Your exec redirect makes no sense if that's exactly what you're running. Read man exec for more details. Dec 21, 2022 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. Dec 21, 2022 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
    – terdon
    Dec 21, 2022 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. Dec 22, 2022 at 7:56

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged .