File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -234,13 +234,20 @@ get_fs_env() {
234234# 8:2
235235get_maj_min () {
236236 local _majmin
237- out=" $( grep -m1 -oP " ^$1 \K\S+$" " ${get_maj_min_cache_file:? } " ) "
238- if [ -z " $out " ]; then
237+ local _out
238+
239+ if [[ $get_maj_min_cache_file ]]; then
240+ _out=" $( grep -m1 -oP " ^$1 \K\S+$" " $get_maj_min_cache_file " ) "
241+ fi
242+
243+ if ! [[ " $_out " ]]; then
239244 _majmin=" $( stat -L -c ' %t:%T' " $1 " 2> /dev/null) "
240- out=" $( printf " %s" " $(( 0 x${_majmin%:* } )) :$(( 0 x${_majmin#*: } )) " ) "
241- echo " $1 $out " >> " ${get_maj_min_cache_file:? } "
245+ _out=" $( printf " %s" " $(( 0 x${_majmin%:* } )) :$(( 0 x${_majmin#*: } )) " ) "
246+ if [[ $get_maj_min_cache_file ]]; then
247+ echo " $1 $_out " >> " $get_maj_min_cache_file "
248+ fi
242249 fi
243- echo -n " $out "
250+ echo -n " $_out "
244251}
245252
246253# get_devpath_block <device>
You can’t perform that action at this time.
0 commit comments