I am trying to write a code that runs a script on a list of files determined based on users input. for some reason the following code doesn't work? is there any way to do evalute the query_cmd and iterate over the files it outputs.
if [[ $# -gt 0 && "$1" == "--diff" ]]; then
  query_cmd="git diff --name-only '*.cc' '*.h'"
else
  query_cmd='find . \( -name "*.cc" -o -name "*.h" \)'
fi
while IFS='' read -r line; do
  absolute_filepath=$(realpath "$line")
  if [[ $absolute_filepath =~ $ignore_list ]]; then
     continue
  fi
  cpp_filepaths+=("$absolute_filepath")
done < <($query_cmd)
 
    