Results 1 to 5 of 5
Hi Guys,
I am trying to use the pv command. I wanted to do something like this
(cp install/common/pcre* /home/karthik;cd /home/karthik;tar -zxvf pcre-*.tar.gz;rm -rf pcre-*.tar.gz;cd pcre*;./configure)
How do I use ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-12-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 3
How to use pipe viewer
Hi Guys,
I am trying to use the pv command. I wanted to do something like this
(cp install/common/pcre* /home/karthik;cd /home/karthik;tar -zxvf pcre-*.tar.gz;rm -rf pcre-*.tar.gz;cd pcre*;./configure)
How do I use the pv for the above command set and show it in a dialog gauge ?
Can someone help me out on this.
- 11-13-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
Hi,
I don't think you can use pv that way. If you want to show progress, you could use the GUI zenity program, e.g.:
however, it does not show command output in the terminal, which I find annoying.Code:#!/bin/bash myfunc(){ command1 command2 etc. } myfunc|zenity --progress --pulsate
you could write your own simple activity widget in Bash, e.g.:
Code:#!/bin/bash myfunc(){ command1 command2 } myfunc > /tmp/myfunc.log 2>&1 & while ps -p $! >/dev/null 2>&1; do printf '*' sleep 1 done echo
- 11-13-2012 #3Just Joined!
- Join Date
- Nov 2012
- Posts
- 3
Thank you.
Since I am using a minimal installed centos 6.2, zenity does not work for me, Is it possible to use the same kind of notation with dialog ?
- 11-13-2012 #4Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,202
Hi.
I use pv to show progress of a tar and gzip. Perhaps this snippet will help you fit pv into your scheme:
The man page for pv shows it being piped into dialog, but I don't use that. This writes directly to STDOUT, so I can watch it in an ssh session.Code:tar cvf - -C $directory . 2>>$LOG | pv -cN tar -s "$size" | gzip | pv -cN gzip > ${destination}
If you want to show the progress of the cp, then pv might not be able to be used, because pv needs to be in the pipeline.
The script bar at Theiling Online: ASCII bar demonstrates how to use bar in some situations as a replacement for cp, showing the progress.
Best wishes ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 11-14-2012 #5Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
Sure, here is a good tutorial on using dialog to do that:
A progress bar (gauge box) - Linux Shell Scripting Tutorial - A Beginner's handbook
I've used the bar that drl mentions, as well, very handy.


Reply With Quote

