问题描述
我正在编写一个bash脚本,该脚本需要从多个远程Subversion存储库中获取源代码.我使用 svn checkout -q
来避免显示冗长的文件列表,这些文件会使输出混乱,但是现在我正在寻找一种干净的方法来在每次 svn checkout期间向用户显示进度信息代码>.
wget
和 curl
的进度指示器有一些相似之处.我将在OSX和Linux中使用用户. pv
都可以使用,但是到目前为止,我还没有找到如何在 svn checkout
中使用它.我还应该说,我不是在寻找使用GUI窗口的工具,而是在寻找纯文本的工具.
I'm writing a bash script that needs to fetch source code from several remote subversion repositories. I use svn checkout -q
to avoid displaying long lists of files that clutter the output but now I'm looking for a clean way to display progress info to the user during each svn checkout
. Something in the vein of wget
and curl
's progress indicators. I'll have users in OSX and Linux. pv
is available on both but so far, I haven't found how to use it with svn checkout
. I should also say that I'm not looking for tools that use GUI windows, but text-only tools.
任何建议都将受到欢迎!谢谢!
Any suggestions would be very welcome! Thanks!
推荐答案
我发现的最近的东西: http://www.danielkraaij.nl/2014/03/30/subversion-progressbar-in-bash/
Closest thing I've found: http://www.danielkraaij.nl/2014/03/30/subversion-progressbar-in-bash/
n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
i=1
while read line filename
do
counter=$(( 100*(++i)/n))
echo -e "($counter %)\n"
echo -e "filename: $filename \n"
done < <(svn co svn://svn/project/trunk /var/www/project)
dialog --backtitle "Subversion Installer" --title "SVN Checkout" --gauge "Getting total file count" 7 120 < <(
n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
i=1
while read line filename
do
counter=$(( 100*(++i)/n))
echo "XXX"
echo "$counter"
echo "filename: $filename"
echo "XXX"
done < <(svn co svn://svn/project/trunk /var/www/project)
)
这篇关于文本模式下svn签出的进度栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!