像 bash 脚本中的 WGET 一样的 SCP 进度条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18071654/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 06:08:29  来源:igfitidea点击:

SCP Progress bar like WGET in bash script

bashshellcentosubuntu-12.04sh

提问by Uvais Ibrahim

I have folder named testfolderwhich contain some files in it my machine. And I want copy this folder to a remote machine using scpcommand as given below.

我有一个名为的文件夹testfolder,其中包含我的机器中的一些文件。我想使用scp下面给出的命令将此文件夹复制到远程机器。

scp -P 6969 testfolder user@remotemachine:/path/to/destination

Here I need to display a progress bar something like we get when using wgetcommand as given below.

在这里,我需要显示一个进度条,就像我们在使用wget下面给出的命令时得到的一样。

[ =============48%                           ]

How can I implement using a bash shell script. Please advice me as I am very beginner inn shell scripting.

如何使用 bash shell 脚本来实现。请给我建议,因为我是非常初学者的旅馆 shell 脚本。

Thanks in advance.

提前致谢。

采纳答案by user2631151

You can use pv

你可以使用pv

Some examples here

这里有一些例子