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

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

 



On Friday 23 January 2004 00:10, Herculano de Lima Einloft Neto wrote:
> Mike Klinke wrote:
> > Perhaps you could create a perl, tcl, or bash script as a front
> > end which you can "alias" to find which will store the stdout in
> > a file for you.
>
> No go.. that would only work for find, and not the hundreds of
> other commands..
 
Drop the alias bit then and make it generic but you'll have to use a 
syntax that included the front end command e.g.:

saveit find ....
saveit grep .....

where "saveit" is your perl, tcl, or bash script.  For example:

===== saveit =======

#!/usr/bin/tclsh
set command [lindex $argv 0]
set data [ exec $command]
puts $data
set fileId [ open command_output_file w 0600 ]
puts $fileId $data
close $fileId

====================

Of course this example will only work for a single argument like ls, 
df, du, etc. but it gives you the idea ...

Regards,  Mike Klinke





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

  Powered by Linux