On 29-03-2011 22:35:48 -0600, Ryan Hill wrote: > > Because 'ls' would complain that files didn't exist, such as lib*.dylib > > when on a Linux system. It doesn't matter. But, using 'find' avoids this > > mess. > > Never use ls to get filenames in a script. Instead of > > for link_source in $(eval ls ${source_dir} 2> /dev/null) ; do > > just use > > for link_source in "${source_dir}"/* ; do > > I see you already fixed this one, but you do some funky stuff with ls -d > earlier on.
Make sure though, when you use a glob, that you check for the asterisk. When there are no matches, bash assumes you meant the literal '*' and hence will return "/foo/bar/*" in link_source. So make sure you check the existence of whatever is in link_source before using it. -- Fabian Groffen Gentoo on a different level