ref
This commit is contained in:
parent
e47f142e59
commit
1f38446b84
@ -50,19 +50,19 @@ alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
|
||||
untar() {
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
local dir_name
|
||||
dir_name="$(basename $1 | cut -d. -f1)"
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
2
.bashrc
2
.bashrc
@ -19,7 +19,7 @@ parse_git_branch() {
|
||||
echo ''
|
||||
return
|
||||
fi
|
||||
|
||||
local branch
|
||||
branch="$(git branch --show-current 2> /dev/null)"
|
||||
|
||||
if [[ -n "$branch" ]]; then
|
||||
|
||||
24
README.md
24
README.md
@ -88,7 +88,8 @@ sudo systemctl status <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
|
||||
[Unit]
|
||||
Description=<DESCRIPTION>
|
||||
@ -110,6 +111,27 @@ RestartSec=5
|
||||
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>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user