1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-29 12:15:29 +02:00
tldr/pages/common/{.md

37 lines
675 B
Markdown
Raw Normal View History

# {
2024-12-20 20:59:35 +02:00
> Multipurpose shell syntax.
> More information: <https://www.gnu.org/software/bash/manual/bash.html>.
2024-12-20 20:59:35 +02:00
- Isolate variable names:
`echo ${HOME}work`
- Brace expand sequences:
`echo {1..3} {a..c}{dir1,dir2,dir3}`
- Check if `variable` is set before returning text:
`echo ${variable:+variable is set and contains $variable}`
- Set default values in case `variable` is unset:
`echo ${variable:-default}`
- Return `variable` length in characters:
`echo ${#variable}`
- Return a string slice:
`echo ${variable:3:7}`
- Recursively expand a `variable`:
`echo ${!variable}`
2025-04-26 05:55:06 +03:00
- Group command output together:
2024-12-20 20:59:35 +02:00
2025-04-26 05:55:06 +03:00
`{ {{command1; command2; ...}} } | {{another_command}}`