mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-30 21:15:29 +02:00
37 lines
716 B
Markdown
37 lines
716 B
Markdown
![]() |
# {
|
||
|
|
||
|
> Multifunctionele shell-syntax.
|
||
|
> Meer informatie: <https://www.gnu.org/software/bash/manual/bash.html>.
|
||
|
|
||
|
- Isoleer variabele namen:
|
||
|
|
||
|
`echo ${HOME}work`
|
||
|
|
||
|
- Breid reeksen uit:
|
||
|
|
||
|
`echo {1..3} {a..c}{dir1,dir2,dir3}`
|
||
|
|
||
|
- Controleer of `variable` is ingesteld voordat tekst wordt geretourneerd:
|
||
|
|
||
|
`echo ${variable:+variable is set and contains $variable}`
|
||
|
|
||
|
- Stel standaardwaarden in als `variable` niet is ingesteld:
|
||
|
|
||
|
`echo ${variable:-default}`
|
||
|
|
||
|
- Geef de lengte van `variable` in tekens:
|
||
|
|
||
|
`echo ${#variable}`
|
||
|
|
||
|
- Geef een sliced string terug:
|
||
|
|
||
|
`echo ${variable:3:7}`
|
||
|
|
||
|
- Breid een `variable` recursief uit:
|
||
|
|
||
|
`echo ${!variable}`
|
||
|
|
||
|
- Groepeer commando uitvoer:
|
||
|
|
||
|
`{ {{commando1; commando2; ...}} } | {{ander_commando}}`
|