How can I get usual screen output in piped tar command? - Setup

This is a discussion on How can I get usual screen output in piped tar command? - Setup ; I am piping the output from tar to directly to gpg for encryption using the command below tar cf - --index-file verbose_output.txt --ignore-failed-read -P -- preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e -r backup@key.domain.com > encrypted.tar.gpg I also ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: How can I get usual screen output in piped tar command?

  1. How can I get usual screen output in piped tar command?

    I am piping the output from tar to directly to gpg for encryption
    using the command below

    tar cf - --index-file verbose_output.txt --ignore-failed-read -P --
    preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    -r backup@key.domain.com > encrypted.tar.gpg

    I also want the list of files which is normally displayed on the
    screen to be saved into a file for later viewing.

    I gather it relates to the way stderr and stdout are handled. I assume
    that stdout is what is sent to gpg so where can stderr be piped to.

    /voipfc


  2. Re: How can I get usual screen output in piped tar command?

    In article <1181912220.511358.257370@o61g2000hsh.googlegroups. com>,
    voipfc wrote:
    :I am piping the output from tar to directly to gpg for encryption
    :using the command below
    :
    :tar cf - --index-file verbose_output.txt --ignore-failed-read -P --
    reserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    :-r backup@key.domain.com > encrypted.tar.gpg
    :
    :I also want the list of files which is normally displayed on the
    :screen to be saved into a file for later viewing.
    :
    :I gather it relates to the way stderr and stdout are handled. I assume
    :that stdout is what is sent to gpg so where can stderr be piped to.

    Instead of having tar send the archive to stdout, try making better
    use of the capabilites of bash:

    tar -cf >(gpg -e -r backup@key.domain.com > encrypted.tar.gpg) \
    --index-file verbose_output.txt --ignore-failed-read -P \
    --preserve --show-omitted-dirs --exclude-from exclude.lst /

    For an explanation of the above, see "Process Substitution" in the
    bash manpage.

    --
    Bob Nichols AT comcast.net I am "RNichols42"

  3. Re: How can I get usual screen output in piped tar command?

    voipfc wrote:
    > I am piping the output from tar to directly to gpg for encryption
    > using the command below
    >
    > tar cf - --index-file verbose_output.txt --ignore-failed-read -P --
    > preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    > -r backup@key.domain.com > encrypted.tar.gpg
    >
    > I also want the list of files which is normally displayed on the
    > screen to be saved into a file for later viewing.
    >
    > I gather it relates to the way stderr and stdout are handled. I assume
    > that stdout is what is sent to gpg so where can stderr be piped to.


    Use the "v" argument in tar:
    tar cvf - --index-file verbose_output.txt --ignore-failed-read -P --
    preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    -r backup@key.domain.com > encrypted.tar.gpg

    --
    saf
    E-Mail protected against spam: ihnnsfbg@smtp2.trashmail.net

  4. Re: How can I get usual screen output in piped tar command?

    voipfc wrote:
    >
    > I am piping the output from tar to directly to gpg for encryption
    > using the command below
    >
    > tar cf - --index-file verbose_output.txt --ignore-failed-read -P --
    > preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    > -r bac...@key.domain.com > encrypted.tar.gpg
    >
    > I also want the list of files which is normally displayed on the
    > screen to be saved into a file for later viewing.


    Look at "tee" for this. It clones its stdin to a file and also to
    stdout.

    > I gather it relates to the way stderr and stdout are handled. I assume
    > that stdout is what is sent to gpg so where can stderr be piped to.


    Nope. You want to do two different things with stdout not
    separate


  5. Re: How can I get usual screen output in piped tar command?

    voipfc wrote:
    >
    > I am piping the output from tar to directly to gpg for encryption
    > using the command below
    >
    > tar cf - --index-file verbose_output.txt --ignore-failed-read -P --
    > preserve --show-omitted-dirs \ --exclude-from exclude.lst / | gpg -e
    > -r bac...@key.domain.com > encrypted.tar.gpg
    >
    > I also want the list of files which is normally displayed on the
    > screen to be saved into a file for later viewing.
    >
    > I gather it relates to the way stderr and stdout are handled. I assume
    > that stdout is what is sent to gpg so where can stderr be piped to.


    Sorry. I think I just sent a partial post with wrong stuff thinking
    I was cancelling it. Switch to cvf and then add 2> verbose.file
    before the pipe to intercept stderr into a file.


+ Reply to Thread