On 2013-11-10 16:02, Bastian Bittorf wrote: > * Felix Fietkau <n...@openwrt.org> [10.11.2013 15:22]: >> We could then also make it check if the /etc/hotplug.d/$SUBSYSTEM >> directory exists before issuing a call to /sbin/hotplug-call. > > this sounds good. so in /sbin/hotplug-call there is > everytime the check > > [ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && { > ... > } > > which can be removed afterwards. > also there is a call which looks strange to me: > > for script in $(ls /etc/hotplug.d/$1/* 2>&-); do ( > [ -f $script ] && . $script > ); done > > i propose this simpler look: > > 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.
- Felix _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel