I need to log theoutput of utilities in a way that I always know its version, 
forwhich I have been using a file with lines of text, each linecontaining 5 
fields with all you need:


<installationprogram>|<utility>|<version option>|<on whichline>|<which string 
on that line>


texlive-extra-utils|pdfcrop|--version|1|3


pdftotext|pdftotext|-v|1|3


kate|kate|--version|1|2


yt-dlp|yt-dlp|--version|1|2


but I don't know howto inset the last (fifth) field into the awk part of the 
statement toget the version:


IFS=$(echo -en"\n\b"); _L_AR=($( echo "${_L}" | tr '|' 
'\n'));_L_ARL=${#_L_AR[@]}


if [[ ${_L_ARL}  -eq5 ]]; then


_UTIL="${_L_AR[1]}"


#


which "${_UTIL}"


"${_UTIL}"${_L_AR[2]} 2>&1 | head -n ${_L_AR[3]}


# _V=${_L_AR[4]};"${_UTIL}" ${_L_AR[2]} 2>&1 | head -n ${_L_AR[3]} |awk '{print 
$'${_V}'}' # can't get the version ..


else


echo "// __\$_L: |${_L}|, \$_L_ARL: |$_L_ARL|"


fi


~


lbrtchx


Reply via email to