-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/30/2011 03:58 AM, Fabian Groffen wrote:
> 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.
> 
> 
Yup, that's part of the reason why I changed to 'find' rather than 'ls'
there. 'find' will return a list matching the criteria, or it'll be
empty. Again, why I didn't use it earlier is beyond me. I think 'ls'
just worked for me and I moved on to getting other bits to work and
forgot about it.

As for the lib_dir(), I'm unsure if that's a good way to handle things.
Or, if it's really the best way, even though it's ugly. There's nothing
preventing me from making it a user configurable...it's just that at
some point I do need to determine the default bitness for the applications.

- - Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iF4EAREIAAYFAk2TDUQACgkQCOhwUhu5AEnnnAD/QPHQ2B3VUlFBQpCBg/8zdXDE
StAmxwYONYECac7ZZdYBAK0YW+JZYo4wez/U+OMNz6bMobNJrlC/e8TPgBQrHYd1
=ppf+
-----END PGP SIGNATURE-----

Reply via email to