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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2004-01-24 at 11:39, Herculano de Lima Einloft Neto wrote:
> Here's an interesting hack. It won't do after all, since it breaks
> things like colors and columns in ls output, man page scrolling.. and
> appends an ugly thing to all the lines in your history, with time. :)
> But it's worth noting, since it illustrates useful resources:
> (could it be fixed?)
> 
> .inputrc:
> "^[k": accept-line
> "^M": " | tee /tmp/h_lastcmd.out ^[k"
> 
> .bash_profile:
> export __=/tmp/h_lastcmd.out
> 
> If you try it, Alt-k will stand for the old Enter; use "command $__" to
> access the last output.

Doesn't work for me - for some reason bash is not picking up those
changes in my $HOME/.inputrc.

But this looks like a great way to achieve what you are after. One
problem with the script I posted is  it won't handle line-continuation. 
Eg.

   find . |\
     wc

But your method should handles this, as long as you use Alt-k for all
but the final line.

Looks like READLINE gives you a lot of powerful features here. 

Cheers, Ben
-- 
.O.    Ben Stringer
..O    ben@xxxxxxxxxxx
OOO    linux|java|majitek|gnu




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux