4

I'm writing a bash script that automates the building, copying and running of a golang app to a remote server. I'm using whiptail to let the user pick some options, enter in some details (e.g. SSH server name, username and password).

When I use sshpass -p mypassword scp myfile user@remoteserver:/location/to/myfile I don't get any progress, the terminal just sits there until it's copied, then carries on. Obviously I can't pass this to whiptail's gauge option. When I run it without sshpass, I get progress info on the screen, but I'd rather use sshpass (not to mention when scp asks for a password, it breaks whiptail's dialog box). Running scp with -v gives tons of debug info but nothing I can clean up and feed into whiptail

So how would I go about showing a progress bar to the user while the file is copied over SSH?

1

I am unfamiliar with sshpass. scp however, has a progress bar using the -3 option.

 $ls -l
-rw-r--r-- 1 root     root     50043369 Jul 17 21:59 gv.tgz

j0h@M0h:~$ scp -3 -P 7935 gv.tgz  j0h@123.1.2.3:/home/j0h/
j0h@123.1.2.3's password: 
gv.tgz                       100%   48MB  11.9MB/s   00:04 

Durring the upload, the last line was changing, indicating progress from 0% to 100%. is this something you can use?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.