From 920988deb0baea12ba4bdba2bc3a6cb957eadf97 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 17 Jun 2018 14:25:59 -0400 Subject: [PATCH] removed needless tests and added an example using braces expansion to loop over files explicitly referenced --- README.md | 5 +++++ test.sh | 10 ---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f3c9e35..766da98 100644 --- a/README.md +++ b/README.md @@ -674,6 +674,11 @@ for dir in ~/Downloads/*/; do printf '%s\n' "$dir" done +# Leverage brace expansion to loop, explicit reference +for file in /path/to/parentdir/{fil1,file2,subdir/file3}; do + printf '%s\n' "$file" +done + # Iterate recursively. shopt -s globstar for file in ~/Pictures/**/*; do diff --git a/test.sh b/test.sh index 0991eac..13138c8 100755 --- a/test.sh +++ b/test.sh @@ -134,16 +134,6 @@ test_read_sleep() { assert_equals "$((result+1))" "$SECONDS" } -test_brace_expansion() { - printf -v result %s {a,{q,x}}c - assert_equals "$result" "acqcxc" -} - -test_brace_expansion_numeric_sequence() { - printf -v result '%s ' {1..10} - assert_equals "$result" "1 2 3 4 5 6 7 8 9 10 " -} - test_bar() { result="$(bar 50 10)" assert_equals "${result//$'\r'}" "[----- ]"