m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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