From 16e6c970bc2a261cb3c890bc92ec41bb393821f5 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 3 Jun 2011 13:24:07 -0400 Subject: functions: refactor checked modules Do a single grep to compare the contents of the module file (if exists) against the results of all_modules for the provided arguments. If there's no module file, this is still just pass through to all_modules. Signed-off-by: Dave Reisner --- functions | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'functions') diff --git a/functions b/functions index 142b974..75ea0a0 100644 --- a/functions +++ b/functions @@ -65,16 +65,11 @@ all_modules () checked_modules () { - if [ -e "${MODULE_FILE}" ]; then - for mod in $(all_modules $@); do - modname=$(get_module_name "${mod}") - if grep -q "^${modname}$" "${MODULE_FILE}"; then - echo ${modname} - fi - done + if [[ -s "$MODULE_FILE" ]]; then + grep -xFf "$MODULE_FILE" <(all_modules "$@") return 1 else - all_modules ${@} + all_modules "$@" fi } -- cgit v1.2.3-24-g4f1b