Find the answer to your Linux question:
Results 1 to 3 of 3
hello I wrote a backup-script with a lot of tests and outputs before and after the backup with rsync... I want to write to stdout (this is normal) and to ...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    28

    write a copy of stdout to a file, but with a read-command inside...

    hello

    I wrote a backup-script with a lot of tests and outputs before and after the backup with rsync...

    I want to write to stdout (this is normal) and to write the same output incl. stderr to a file... (the whole output of the script, not only from one command).

    And, there is also a bigger problem, I have at the beginning a read-command, the logfile don't must have the input, but should wait and after the input of the user it should do the job of logging further...

    I googled a lot and read a lot of manpages (pipes, tee, ...) but, there is allways only one command or, then without a read inside the script...

    This should be possible, I'm right?

    Thanks for any help..
    raphael

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I don't understand why the read complicates matters. The prompt will appear in the logfile, and the inputted text will not be. And then it will continue.

    The bigger problem will be dealing with stderr. Because piping only pipes stdout, you will need to merge stderr into stdout:
    Code:
    backup_script 2>&1 | tee logfile
    Is there something I'm missing here?
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    28
    yes, you are right, it works! Thanks a lot! Now, I run a first script which one start the next with tee... etc...

    Thank you!
    Greetings, Raphael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...