From a2d687b2fceef584872c8b9899c1da7d1f87dccf Mon Sep 17 00:00:00 2001 From: Andreas Hofmann Date: Sat, 9 Jul 2016 13:22:20 +0200 Subject: [PATCH] Added curly-braces-in-script hint Signed-off-by: Andreas Hofmann --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 8e93a9a..85ad1bc 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,14 @@ Notes: diff /etc/hosts <(ssh somehost cat /etc/hosts) ``` +- When writing scripts you may want to put all of your code in curly braces: +```sh +{ + # Your code here +} +``` +If the closing brace is missing, your script will be prevented from executing due to a syntax error. This makes sense when your script is going to be downloaded from the web, since it prevents partially downloaded scripts from executing. + - Know about "here documents" in Bash, as in `cat <logfile 2>&1` or `some-command &>logfile`. Often, to ensure a command does not leave an open file handle to standard input, tying it to the terminal you are in, it is also good practice to add `