From 64cc308063247b78a1f1d28d878e5453d8557628 Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:59:35 +0200 Subject: [PATCH] {: add page (#15234) --- pages/common/{.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pages/common/{.md diff --git a/pages/common/{.md b/pages/common/{.md new file mode 100644 index 000000000..d8d56788f --- /dev/null +++ b/pages/common/{.md @@ -0,0 +1,36 @@ +# Curly brace + +> Multipurpose shell syntax. +> More information: . + +- 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^^}`