Browse Source

Make use of exit status to detect missing module

Alois Mahdal 6 years ago
parent
commit
548426865c
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      src/shellfu.sh.skel

+ 2
- 3
src/shellfu.sh.skel View File

@@ -132,8 +132,7 @@ shellfu() {
132 132
             local es=4
133 133
             local mpath
134 134
             shellfu __debug "importing module $mname"
135
-            mpath=$(shellfu _select_mfile "$mname")
136
-            test -n "$mpath" || {
135
+            mpath=$(shellfu _select_mfile "$mname") || {
137 136
                 shellfu __warn "cannot find module: $mname"
138 137
                 return 3
139 138
             }
@@ -180,7 +179,7 @@ shellfu() {
180 179
             #
181 180
             # Select file that contains module named $1
182 181
             #
183
-            shellfu _list_mfiles "$1" | head -1
182
+            shellfu _list_mfiles "$1" | grep -m1 .
184 183
             ;;
185 184
 
186 185
         *)