mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-09-10 16:13:31 +02:00
{: add page (#15234)
This commit is contained in:
parent
4e7255c612
commit
64cc308063
1 changed files with 36 additions and 0 deletions
36
pages/common/{.md
Normal file
36
pages/common/{.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Curly brace
|
||||
|
||||
> Multipurpose shell syntax.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-hash>.
|
||||
|
||||
- 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}`
|
||||
|
||||
- Capitalize all the characters:
|
||||
|
||||
`echo ${variable^^}`
|
Loading…
Add table
Reference in a new issue