meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:bash [2022/08/25 08:53] – niziak | linux:bash [2023/11/23 06:57] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Bash ====== | ====== Bash ====== | ||
| + | |||
| + | ===== re-run as other user ===== | ||
| + | |||
| + | <code bash> | ||
| + | if [ $UID == 0 ]; then | ||
| + |     exec su -c " | ||
| + | fi | ||
| + | </ | ||
| ===== Check if command is installed ===== | ===== Check if command is installed ===== | ||
| Line 8: | Line 16: | ||
| exit 1 | exit 1 | ||
| fi | fi | ||
| + | </ | ||
| + | |||
| + | and use it inside loop: | ||
| + | <code bash> | ||
| + | for tool in awk bc sed; do | ||
| + | .... | ||
| + | done | ||
| </ | </ | ||