On 2013-11-10 16:16, Bastian Bittorf wrote: > * Felix Fietkau <n...@openwrt.org> [10.11.2013 16:13]: >> > for FILE in /etc/hotplug.d/$1/*; do ( >> > command . "$FILE" >> > ); done >> > >> > because we know, that the directory exists >> > and there is no need to fork "ls" and there >> > is no need to check for a file if we use 'command' >> > (a builtin). FILE should be used uppercase, because >> > this is a global var (just cosmetic). >> We may know that the directory exists, but that doesn't mean that there >> are files in there. > > if there are no files, than the call is e.g.: > > command . /etc/hotplug.d/iface/* > > (which throws an error, but does not hurt). the call I'd prefer preventing unnecessary logspam.
> test -f $file && . $file > > is racy anyway. just use 'command' than, it tests for > existence itself 8-) How is it racy? /etc/hotplug.d/* doesn't usually change at run time. - Felix _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel