How to create a shell script that will find a specific file and apply it on a script that will be executed

Good day! I’m trying to create a shell script that will do the ff.

  1. list all files which has a name of core.* from a specific directory (/opt/info)
  2. count number of core.* files
  3. if core.* > 0
    then return number of core files
    ECHO “Core files exist:
  4. get the filename of one of the core files (can be random or sequential)
  5. use the filename in the script that will be executed below:
    execute the script: strings (core.*) | grep “pmdtm(“
  6. if the script in #5 doesn’t work or no values returned
    then echo “ERROR: Script1 didn’t worked!” and execute the script: file (core.*) and print the results.
    else print the results in script1.
  7. Assign the results to parameter/variables.

God bless!

-Jerome