aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-04-05 22:43:27 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-04-05 22:43:27 +0200
commit7f8aef4d417e427153caba4255a2282cb9dd30d9 (patch)
tree3a9766ac49c0da53c898cd8b8d96089904375943
parent49eefec4f5d470ae3538bded9ca758cf178bb7aa (diff)
downloadnotes-7f8aef4d417e427153caba4255a2282cb9dd30d9.tar.gz
notes-7f8aef4d417e427153caba4255a2282cb9dd30d9.zip
bash: printf -v
-rw-r--r--src/tools/bash.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/bash.md b/src/tools/bash.md
index e12d8c0..f27b3a2 100644
--- a/src/tools/bash.md
+++ b/src/tools/bash.md
@@ -41,6 +41,11 @@ ${foo/pattern/string} # replace pattern with string when expanding foo
# '/' replace all occurences of pattern
# '#' pattern match at beginning
# '%' pattern match at end
+
+# set programmatically with priintf builtin
+printf -v "VAR1" "abc"
+NAME=VAR2
+printf -v "$NAME" "%s" "def"
```
> Note: `prefix`/`suffix`/`pattern` are expanded as [pathnames](#pathname).