From f0ec1111d30e9432a476e6cd76689ab4579f214a Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Mon, 15 Mar 2010 08:01:04 +1100 Subject: [PATCH] QA /technical/2008/04/expand-glob-in-variable-within-shell-script/ --- .../expand-glob-in-variable-within-shell-script.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/technical/2008/04/expand-glob-in-variable-within-shell-script.html b/content/technical/2008/04/expand-glob-in-variable-within-shell-script.html index 79db2c4..d62e294 100644 --- a/content/technical/2008/04/expand-glob-in-variable-within-shell-script.html +++ b/content/technical/2008/04/expand-glob-in-variable-within-shell-script.html @@ -1,8 +1,9 @@ I had the need today to read in a list of patterns from a file, expand them and then operate upon each file all from within a shell script. Apparently there is a shell built-in for csh, but I didn't want to learn csh at that point. The eventual solution was to run an extra shell with the -c argument. Example: -
#!/bin/bash
-FILES=`cat patterns.txt`
-for pattern in $FILES; do
-    bash -c "ls -l ${pattern}"
-done
+ #!/bin/bash + FILES=`cat patterns.txt` + for pattern in $FILES; do + bash -c "ls -l ${pattern}" + done + \ No newline at end of file