On Sun, Sep 20, 2020 at 3:15 AM wrote:
>
> On 20.09.2020 07:31, Rosen Penev wrote:
> > - for file in $(ls $1/*.sh 2>/dev/null); do
> > - . $file
> > + for file in "$1"/*.sh; do
> > + [ -e "$file" ] || break
> > + . "$file"
>
> the existence check is
On 20.09.2020 07:31, Rosen Penev wrote:
> - for file in $(ls $1/*.sh 2>/dev/null); do
> - . $file
> + for file in "$1"/*.sh; do
> + [ -e "$file" ] || break
> + . "$file"
the existence check is probably meant to catch "../*.sh" entry found if no
files
>From https://github.com/koalaman/shellcheck/wiki/SC2045 :
When looping over a set of files, it's always better to use globs when
possible. Using command expansion causes word splitting and glob
expansion, which will cause problems for certain filenames (typically
first seen when trying to