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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.