ref
This commit is contained in:
parent
e47f142e59
commit
1f38446b84
@ -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
|
||||||
|
|
||||||
|
|||||||
2
.bashrc
2
.bashrc
@ -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
|
||||||
|
|||||||
24
README.md
24
README.md
@ -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>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user