From 7981a689ff1d29112804bfde652acf40efe45f95 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Thu, 23 Sep 2021 16:21:20 +0300 Subject: [PATCH] ref --- .bashrc | 1 + README.md | 57 +++------------------------- etc/bash_completion.d/ssh | 10 +++++ etc/systemd/system/.service | 18 +++++++++ 4 files changed, 34 insertions(+), 52 deletions(-) create mode 100644 etc/bash_completion.d/ssh create mode 100644 etc/systemd/system/.service diff --git a/.bashrc b/.bashrc index 1839b62..3df477c 100644 --- a/.bashrc +++ b/.bashrc @@ -1,3 +1,4 @@ +. /etc/bash_completion.d/ssh if type shopt 2>/dev/null 1>&2; then diff --git a/README.md b/README.md index 88c9c0b..e7d8789 100644 --- a/README.md +++ b/README.md @@ -79,60 +79,13 @@ ssh hosting 'rm -rf ~/BashConfig; git clone https://github.com/TheK4n/BashConfig ### Autostart - +* create /etc/systemd/system/.service ```bash -sudo vim /etc/systemd/system/.service +sudo vim /etc/systemd/system/.service sudo systemctl daemon-reload -sudo systemctl start .service -sudo systemctl status .service -sudo systemctl enable .service +sudo systemctl start .service +sudo systemctl status .service +sudo systemctl enable .service ``` - -#### file "/etc/systemd/system/.service" -```text -[Unit] -Description= -After=network.target - -[Service] -Type=simple -User= -Group= - -ExecStart= -ExecReload= -WorkingDirectory= -KillMode=process -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -``` - - - -### Autocomplete - -#### file "/etc/bash_completion.d/ssh" -```bash -_ssh() { - local cur prev opts - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-) - COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) - return 0 -} - -complete -F _ssh ssh - -``` - -

- - - diff --git a/etc/bash_completion.d/ssh b/etc/bash_completion.d/ssh new file mode 100644 index 0000000..8fe2e09 --- /dev/null +++ b/etc/bash_completion.d/ssh @@ -0,0 +1,10 @@ +_ssh() { + local cur opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-) + COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) + return 0 +} + +complete -F _ssh ssh diff --git a/etc/systemd/system/.service b/etc/systemd/system/.service new file mode 100644 index 0000000..865b533 --- /dev/null +++ b/etc/systemd/system/.service @@ -0,0 +1,18 @@ +[Unit] +Description= +After=network.target + +[Service] +Type=simple +User= +Group= + +ExecStart= +ExecReload= +WorkingDirectory= +KillMode=process +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target \ No newline at end of file