Re: bash: any way to reuse the last output?

From: Kir Kolyshkin (kir_at_darnet.ru)
Date: 01/25/04

  • Next message: Mike Watson: "Re: ADMtek 6211 wireless PCI cards"
    To: fedora-list@redhat.com
    Date: Sun, 25 Jan 2004 02:12:32 +0300
    
    

    Herculano de Lima Einloft Neto wrote:

    > just the way I always have, and when the _unexpected_ wish to
    > manipulate the last output gets me by surprise, I will do, for instance:
    > (say, with grep)
    >
    > grep whatever $__
    >
    > There.. wouldn't it be nice? :)

    Nope. Think of the command which produces a really long output...do you
    want it to be saved in memory?

    Anyway, there are a several solutions to your problem. First, as it was
    mentioned here already, you can use tee or output redirection (> or >>).
    Second, you can use script command (see 'man script' for details).
    Third, you can save command output into a variable, like this:

    OUT=`find /`

    and use it like any other shell variable.
    (Fourth;) You can even make a short script, like this:

    #!/bin/bash
    # so - Save Output. Saves output of command in OUT shell variable.
    OUT=`$*`
    echo $OUT

    and use it like this
    so find . -name myfile

    And the last thing is to copy-paste from your terminal.

    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Mike Watson: "Re: ADMtek 6211 wireless PCI cards"

    Relevant Pages