m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2021-03-25 11:53:28 +0100
committerMarcin Chrzanowski <m@m-chrzan.xyz>2021-03-25 11:53:28 +0100
commit7cb4d8944f37362b4579bcc5054e954e6701b49b (patch)
treed5cc0773925b984c0d807c893b0e7837e4ada935
parenta4b0fad555989e17b5f8d5f82088dba0d768063b (diff)
Update bash
-rw-r--r--bash.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/bash.md b/bash.md
index d150702..41e8f05 100644
--- a/bash.md
+++ b/bash.md
@@ -29,6 +29,27 @@ Loop over integers
## Conditionals
* `-z`: is empty string
+* `-n`: non-empty string
* `-f`: is regular file
* `$A == $B`: string equality, accepts globs
* `$A != $B`: string inequality
+
+## Heredocs
+
+ cat << EOF > file
+ bla bla
+ EOF
+
+Ignoring the initial indent:
+
+ ...
+ cat <<- EOF > file
+ bla bla
+ EOF
+ ...
+
+Don't interpolate variables:
+
+ cat << 'EOF' > file
+ bla bla
+ EOF