As a scientist ssh
is one the most used service in my daily work routine. Recently I have discovered some issue with the bash-completion
repo for scp
command. This is my journey for how I fix the issue.
There was a issue with the remote file path completion with scp command. If remote server uses non-default or not configured port number, remote file completion does not work at all because of it does not know which port to use for connection. (actually it tries out default port for connection and it fails eventually).
What I did to fix this issue is: parse -P portnumber
part from the scp command and pass the portnumber
as argument to ssh command for successful connection.
I have checked these different command variations and all of them is working as intended.
> scp -P 1234 server.com:/Users/admin
> scp -P1234 server.com:/Users/admin/
> scp -rP1234 server.com:/Users/admin/
> scp -rP1234 server.com:/Users/admin/
> scp -rP 1234 server.com:/Users/admin/
> scp -rxxxP 1234 server.com:/Users/admin/
> scp -r -P 1234 server.com:/Users/admin/
> scp -P 1234 -r server.com:/Users/admin/
> scp -P1234 -r server.com:/Users/admin/
> scp -r -P1234 server.com:/Users/admin/
> scp -r -P1234 server-Px999:/Users/admin/
> scp -r -P1234 server-Px999:/Users/admin/
> scp -r -P1234 server-P999.com:/Users/admin/
> scp -P 1234 serverP9999.com:/Users/admin/
> scp -rxXXP 1234 server.com:/Users/admin/
> scp -P1234 server.com:/Users/Ps9999/
> scp -r -P1234 server.com:/Users/adminP999/
> scp -r -P1234 server.com:/Users/adminP999/
> scp -r -P1234 server.com:/Users/adminP999
> scp -r -P1234 server.com:/Users/admin-P999
> scp -P1234 carbon-1P9999:/Users/admin/
> scp -P1234 carbonP9999:/Users/admin/
> scp carbon-P9999:/Users/admin/
> scp carbonP9999:/Users/admin/
> scp -r carbonP9999:/Users/admin/
-- coming soon --
Sed js org is usefull for testing live regex patterns with sed.