misc:code_snippets:shell
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| misc:code_snippets:shell [2016/09/27 15:04] – created sascha | misc:code_snippets:shell [2025/11/22 09:10] (current) – Einzeiler für Basispfad des ausgeführten Skripts sascha | ||
|---|---|---|---|
| Line 36: | Line 36: | ||
| cd - | cd - | ||
| + | |||
| + | ==== Basispfad des ausgeführten Skripts ermitteln ==== | ||
| + | |||
| + | DIR=$( cd -- "$( dirname -- " | ||
| + | |||
| + | Folgt auch Symlinks und funktioniert, | ||
| ==== Formatierung '' | ==== Formatierung '' | ||
| Line 91: | Line 97: | ||
| round 42/3.14159 | round 42/3.14159 | ||
| round 17/13 7 | round 17/13 7 | ||
| + | |||
| + | ==== Überprüfen, | ||
| + | |||
| + | <code bash check_module.sh> | ||
| + | #!/bin/sh | ||
| + | |||
| + | # check if a kernel module is loaded | ||
| + | |||
| + | [ " | ||
| + | |||
| + | #if lsmod | grep -Eq " | ||
| + | if grep -Eq " | ||
| + | [ " | ||
| + | exit 0 | ||
| + | else | ||
| + | [ " | ||
| + | exit 1 | ||
| + | fi | ||
| + | </ | ||
| {{tag> | {{tag> | ||
misc/code_snippets/shell.1474988646.txt.gz · Last modified: (external edit)
