aboutsummaryrefslogtreecommitdiff
path: root/STRINGS.html
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-18 09:56:29 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-18 09:56:29 +0200
commit27577da287d57be67f3dc9be5e7d88430618893c (patch)
tree751d5d43e17f532b54266bce503f3286d6d64f5d /STRINGS.html
parent65e2eebbcfa34e10824447c05d3ef14f77ba583f (diff)
downloadbashlib-27577da287d57be67f3dc9be5e7d88430618893c.tar.gz
bashlib-27577da287d57be67f3dc9be5e7d88430618893c.tar.bz2
bashlib-27577da287d57be67f3dc9be5e7d88430618893c.zip
update
Diffstat (limited to 'STRINGS.html')
-rw-r--r--STRINGS.html27
1 files changed, 0 insertions, 27 deletions
diff --git a/STRINGS.html b/STRINGS.html
deleted file mode 100644
index 687456f..0000000
--- a/STRINGS.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<h1>Bash string manipulation cheatsheet</h1>
-<p><a href="https://gist.github.com/magnetikonline/90d6fe30fc247ef110a1">https://gist.github.com/magnetikonline/90d6fe30fc247ef110a1</a></p>
-<p>| <strong>Assignment</strong> | |
-| :--- | :--- |
-| Assign <code>value</code> to <code>variable</code> if <code>variable</code> is not already set, <code>value</code> is returned. <!-- raw HTML omitted --> <!-- raw HTML omitted -->Combine with a <code>:</code> no-op to discard/ignore return <code>value</code>. | <code>${variable=&quot;value&quot;}</code> <!-- raw HTML omitted --><code>: ${variable=&quot;value&quot;}</code> |
-| <strong>Removal</strong> | |
-| Delete shortest match of <code>needle</code> from front of <code>haystack</code>. | <code>${haystack#needle}</code> |
-| Delete longest match of <code>needle</code> from front of <code>haystack</code>. | <code>${haystack##needle}</code> |
-| Delete shortest match of <code>needle</code> from back of <code>haystack</code>. | <code>${haystack%needle}</code> |
-| Delete longest match of <code>needle</code> from back of <code>haystack</code>. | <code>${haystack%%needle}</code> |
-| <strong>Replacement</strong> | |
-| Replace first match of <code>needle</code> with <code>replacement</code> from <code>haystack</code>. | <code>${haystack/needle/replacement}</code> |
-| Replace all matches of <code>needle</code> with <code>replacement</code> from <code>haystack</code>. | <code>${haystack//needle/replacement}</code> |
-| If <code>needle</code> matches front of <code>haystack</code> replace with <code>replacement</code>. | <code>${haystack/#needle/replacement}</code> |
-| If <code>needle</code> matches back of <code>haystack</code> replace with <code>replacement</code>. | <code>${haystack/%needle/replacement}</code> |
-| <strong>Substitution</strong> | |
-| If <code>variable</code> not set, return <code>value</code>, else <code>variable</code>. | <code>${variable-value}</code> |
-| If <code>variable</code> not set <em>or</em> empty, return <code>value</code>, else <code>variable</code>. | <code>${variable:-value}</code> |
-| If <code>variable</code> set, return <code>value</code>, else null string. | <code>${variable+value}</code> |
-| If <code>variable</code> set <em>and</em> not empty, return <code>value</code>, else null string. | <code>${variable:+value}</code> |
-| <strong>Extraction</strong> | |
-| Extract <code>length</code> characters from <code>variable</code> starting at <code>position</code>. | <code>${variable:position:length}</code> |
-| Return string length of <code>variable</code>. | <code>${#variable}</code> |
-| <strong>Escaping</strong> | |
-| Single quotes inside a single quoted string. | <code>echo 'Don'\''t break my escape!'</code> |
-| <strong>Indirection</strong> | |
-| Return value of variable name held in <code>indirect</code>, else <code>value</code>. | <code>indirect=&quot;apple&quot;</code> <!-- raw HTML omitted --><code>apple=&quot;fruit&quot;</code> <!-- raw HTML omitted --><code>${!indirect-value}</code> |</p>