This commit is contained in:
TheK4n 2021-09-23 14:16:27 +03:00
parent e47f142e59
commit 1f38446b84
3 changed files with 28 additions and 6 deletions

View File

@ -50,19 +50,19 @@ alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
untar() { untar() {
if ! [ -f $1 ]; then if ! [ -f $1 ]; then
echo "\033[0;31merror: file '$1' not found\e[m" >&2 echo "error: file '$1' not found" >&2
return 1 # exit code return 1 # exit code
fi fi
local dir_name
dir_name="$(basename $1 | cut -d. -f1)" dir_name="$(basename $1 | cut -d. -f1)"
if [ -d $dir_name ]; then if [ -d $dir_name ]; then
echo "\033[0;31merror: directory '$dir_name' exists\e[m" >&2 echo "error: directory '$dir_name' exists" >&2
return 1 # exit code return 1 # exit code
fi fi
if [ -f $dir_name ]; then if [ -f $dir_name ]; then
echo "\033[0;31merror: file '$dir_name' exists\e[m" >&2 echo "error: file '$dir_name' exists" >&2
return 1 # exit code return 1 # exit code
fi fi

View File

@ -19,7 +19,7 @@ parse_git_branch() {
echo '' echo ''
return return
fi fi
local branch
branch="$(git branch --show-current 2> /dev/null)" branch="$(git branch --show-current 2> /dev/null)"
if [[ -n "$branch" ]]; then if [[ -n "$branch" ]]; then

View File

@ -88,7 +88,8 @@ sudo systemctl status <your_bot_name>.service
sudo systemctl enable <your_bot_name>.service sudo systemctl enable <your_bot_name>.service
``` ```
**"/etc/systemd/system/<your_bot_name>.service"**
#### file "/etc/systemd/system/<your_bot_name>.service"
```text ```text
[Unit] [Unit]
Description=<DESCRIPTION> Description=<DESCRIPTION>
@ -110,6 +111,27 @@ RestartSec=5
WantedBy=multi-user.target 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
```
<h1 align="center"><a href="#top"></a></h1> <h1 align="center"><a href="#top"></a></h1>