file progress in xterm titlebar with bash
I'm almost able to have a file's progress outputted in the xterm titlebar. Right now, I have a function in .bashrc similar to this:
function prog(){
case $TERM in
xterm*)
PS1="\[\033]0; `grep "bleh" FILE1 -c` out of `grep "blah" FILE2 | awk '{ print $3 }'`\007\][bash:\W]$ "
;;
*)
PS1="[bash:\W]$ "
;;
esac
}
( i found the main code to this function on a site, i don't actually know much in the way of syntax)
What it does is count the number of times "bleh" appears in FILE1 -- in this way I can view how many iterations are done. It also reads the number of total iterations that will be done from FILE2 on the line that contains "blah" (in column 3 of that line).
When I execute:
$ prog
in the directory with these files, the titlebar changes to " x out of y ", BUT it only does this once. What I want it to do is, once prog is executed, have it repeatedly execute the command inside prog( ){....} (or better yet have it do it every few seconds), so that I can view the progress of the file.... until I hit CTRL+C (or something) and stop prog.
Thanks.
Last edited by brian0918; 06-11-2003 at 05:04 PM.
|