I'm trying to find a files with name and copy it into one text file using bash scripting
What I need to do is I want to add one more command to it so that it is iterate through these files and execute gdb command for each file and print those gdb details into same file which created before
what I'm doing is
#!bin/bash
fpath=/home/filepath
find $fpath -name "core.*" -exec ls -larh {} ; > $fpath/deleted_files.txt
while read line; do gdb ./exec $line done; < $fpath/deleted_files.txt
It should read the only file name like below
gdb ./exec core.123
But Its reading the files like below and giving error
gdb ./exec -rw-rw-r-- 1 home home 0 2022-12-06 13:59 /home/filepath/core.123
gdb : unrecognised option '-rw-rw-r--'
How can i give only filename into that command and paste it into txt file.