Skip to content

Instantly share code, notes, and snippets.

@nhthai2005
nhthai2005 / Autocomplete_ssh_scp.md
Last active January 30, 2024 14:30
Autocomplete server names for SSH and SCP for Git Bash

Autocomplete server names for SSH and SCP for Git Bash

For ssh

1. Make a file with name ssh as following content:

_ssh() 
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
trial=0; until apt-get update -y || [ $trial -eq 4 ]; do sleep $((2**++trial )); done