Update cheatsheets

This commit is contained in:
ivuorinen
2024-12-21 00:17:09 +00:00
parent 993939500e
commit 212b0d47b3
13 changed files with 266 additions and 16 deletions

41
tldr/{ Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# 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^^}`