Script that verify output after make

Hi

I write below script to show if expected file exist in /etc/library/ , print success else failed. But it will print full path I just need to print module name in output. And if it possible show time that spent to compile each module.

FYI 1: First run another script just go to the paths and run �make clean; make� on each module to compile source code, after that put result in /etc/library/. After that this script check if module compile successfully or not!

FYI 2: after run compile.sh it will create logfile that print lot's of info I just need to show error that belong to the fail module.

1-compile.sh > (create logfile)
2-verify.sh (check expected file and if not exist grep that section of logfile that belong to this module )

Here is the verify.sh

for f in /etc/library/{module1,module2,moduleN}; do

  if [ -f "$f" ]; then
    echo "$f Build [Success]"
  else
    echo "$f Build [Failed]"
  fi
done

Current result:

/etc/library/ module1 Build [Success]
/etc/library/ module2 Build [Failed]      
/etc/library/ moduleN Build [Success]

Expected result:

module1 Build [Success] 2s
module2 Build [Failed] 8s         related library not exist for module2
moduleN Build [Success] 58s

Any recommendation?

To get just the filename you can use ${f##*/} instead of $f (within double quotes)

1 Like