From 5e107b9c05c948f27fe2907974a5f241022a297d Mon Sep 17 00:00:00 2001 From: koalaman Date: Wed, 29 Apr 2015 18:19:15 -0700 Subject: [PATCH] Updated Sc2086 (markdown) --- Sc2086.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sc2086.md b/Sc2086.md index 844516e..466945d 100644 --- a/Sc2086.md +++ b/Sc2086.md @@ -22,10 +22,15 @@ Sometimes you want to split on spaces, like when building a command line. options="-j 5 -B" make $options file -Just quoting this doesn't work. Instead, you should have used an array: +Just quoting this doesn't work. Instead, you should have used an array (bash): options=(-j 5 -B) make "${options[@]}" file -To split on spaces but not perform glob expansion, Bash has a `set -f` to disable globbing. You can disable word splitting by setting IFS="". +or a function (POSIX): + + make_with_flags() { make -j 5 -B "$@"; } + make_with_flags file + +To split on spaces but not perform glob expansion, Posix has a `set -f` to disable globbing. You can disable word splitting by setting IFS="".