This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| shell:if-for-while-function-variable [2026/01/19 15:23] – [While] tmade | shell:if-for-while-function-variable [2026/10/19 16:38] (current) – [Function] tmade | ||
|---|---|---|---|
| Line 424: | Line 424: | ||
| </ | </ | ||
| + | Check, when a folder will be created: | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # Path to folder | ||
| + | FOLDER="/ | ||
| + | |||
| + | echo "Wait until: $FOLDER" | ||
| + | |||
| + | # ! -d prüft, ob das Verzeichnis NOCH NICHT existiert | ||
| + | while [ ! -d " | ||
| + | sleep 1 # waiting.... | ||
| + | done | ||
| + | |||
| + | echo " | ||
| + | </ | ||
| ==== Function ==== | ==== Function ==== | ||
| Line 449: | Line 465: | ||
| fi | fi | ||
| </ | </ | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | function test { | ||
| + | echo $1 | ||
| + | echo $2 | ||
| + | } | ||
| + | |||
| + | test first second | ||
| + | </ | ||
| + | |||
| + | Output: | ||
| + | first | ||
| + | second | ||
| + | |||
| + | |||
| + | |||
| Example: | Example: | ||