From 720eb803375a1b31c766f1775fd13c4169ebcfe4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jul 2015 00:04:05 -0600 Subject: bash-arrays: the path_ls() example was leaking IFS. Thanks /u/Vaphell ! --- public/bash-arrays.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/bash-arrays.md b/public/bash-arrays.md index 23d90bb..e7f5842 100644 --- a/public/bash-arrays.md +++ b/public/bash-arrays.md @@ -348,8 +348,9 @@ an array is when you didn't want an array, but it's what you get # Does not correctly handle programs with a newline in the name, # as the output is newline-separated. path_ls() { - local dirs - IFS=: dirs=($@) # The odd-ball time that it needs to be unquoted + local IFS dirs + IFS=: + dirs=($@) # The odd-ball time that it needs to be unquoted find -L "${dirs[@]}" -maxdepth 1 -type f -executable \ -printf '%f\n' 2>/dev/null | sort -u } -- cgit v1.1-4-g5e80