bash: any way to reuse the last output?
Mike Klinke
lsomike at futzin.com
Fri Jan 23 06:26:48 UTC 2004
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
More information about the fedora-list
mailing list