Merge branch 'master' into vhs
This commit is contained in:
@@ -14,20 +14,31 @@ Once installed, search for the service name, and start it.
|
||||
|
||||
```bash
|
||||
sudo systemctl list-unit-files | grep cron
|
||||
sudo systemctl enable --now $NAME
|
||||
```
|
||||
|
||||
Make a file for your crontab, like this:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable --now cron
|
||||
echo '39 */3 * * * /usr/bin/updatedb' > "$USER".cron
|
||||
```
|
||||
|
||||
You can *e*dit your crontab with:
|
||||
Then apply that crontab:
|
||||
|
||||
```bash
|
||||
crontab -e
|
||||
crontab "$USER".cron
|
||||
rm "$USER".cron
|
||||
```
|
||||
The `cron` program will check your syntax before adding the tab.
|
||||
|
||||
Your crontab file sits somewhere in `/var/spool/`.
|
||||
Probably in `/var/spool/cron`.
|
||||
|
||||
> 39 */3 * * * /usr/bin/updatedb
|
||||
Check how your tab currently looks:
|
||||
|
||||
```bash
|
||||
crontab -l
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
@@ -91,7 +102,7 @@ run-parts /etc/cron.hourly
|
||||
### Variables
|
||||
|
||||
Add your `$HOME` to crontab to use scripts.
|
||||
First add `HOME=/home/user`, then you can use syntax like this:
|
||||
First add `HOME=/home/$USER`, then you can use syntax like this:
|
||||
|
||||
0 * * * * $HOME/.scripts/myScript.sh
|
||||
|
||||
@@ -100,7 +111,6 @@ First add `HOME=/home/user`, then you can use syntax like this:
|
||||
```bash
|
||||
$HOME/.scripts/myScript.sh
|
||||
```
|
||||
|
||||
You can also add your regular path to your crontab as a variable (see example below).
|
||||
If you're using vim as the editor, just run this at the top of your crontab:
|
||||
|
||||
@@ -131,5 +141,3 @@ PATH=/usr/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/u
|
||||
50 18 * * * /usr/bin/timeout 30m /usr/bin/syncthing
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
22
basics/eval.md
Normal file
22
basics/eval.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "eval"
|
||||
tags: [ "basics" ]
|
||||
---
|
||||
|
||||
Compose a statement for execution.
|
||||
|
||||
```bash
|
||||
x='echo $y'
|
||||
echo $x
|
||||
y=dragon
|
||||
eval "$x"
|
||||
```
|
||||
|
||||
The results remain in the current shell, unlike sub-shells.
|
||||
|
||||
```bash
|
||||
b=basilisk
|
||||
sh -c 'echo $b'
|
||||
eval "g=goblin"
|
||||
echo $g
|
||||
```
|
11
basics/games.md
Normal file
11
basics/games.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "bash games"
|
||||
tags: [ "Documentation", "Games" ]
|
||||
---
|
||||
|
||||
Games are a great way to learn bash.
|
||||
|
||||
- `mapscii.me` is an interactive terminal map.
|
||||
1. Install telnet.
|
||||
1. `telnet mapscii.me`
|
||||
- [Over the Wire](https://overthewire.org/wargames) teaches bash with small challenging you can do over `ssh`.
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "tree"
|
||||
tags: [ "basics" ]
|
||||
tags: [ "basics", "tree", "markdown" ]
|
||||
---
|
||||
|
||||
The `tree` utility outputs a full listing of everything in your current directory, and those below.
|
||||
@@ -23,3 +23,14 @@ README.md
|
||||
```
|
||||
|
||||
Each description-line starts with a tab.
|
||||
|
||||
## Markdown Conversion
|
||||
|
||||
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
|
||||
|
||||
```bash
|
||||
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
|
||||
sed -e 's/| \+/ /g' \
|
||||
-e 's/[|`]-\+/ */g' \
|
||||
-e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g'
|
||||
```
|
||||
|
Reference in New Issue
Block a user