Issue
I am not too used to bash script so kindly bear with me The following code prints the array in the output file that grep creates. what is it that I am missing?
ids=(eebab078-6076-4ed7-91bb-624313865380)
ids+=(cd0b1f5d-2c86-43d4-ad86-b8beef7db4c9)
echo 'start processing'
for id in ${ids[@]}; do
echo 'processing' $id
grep -rih --exclude-dir={reprocessing} $id >> '../result-test.dat'
done
echo 'end processing'
The output looks like this. I am only expecting the search results not the extra ids which is part of the array.
search results
ids=(eebab078-6076-4ed7-91bb-624313865380)
ids+=(cd0b1f5d-2c86-43d4-ad86-b8beef7db4c9)
Any help will be greatly appreciated
Solution
Thanks very much @William Pursell
your answer helped me move in the right direction
used this script that worked
ids=(eebab078-6076-4ed7-91bb-624313865380)
ids+=(cd0b1f5d-2c86-43d4-ad86-b8beef7db4c9)
echo 'start processing'
for id in ${ids[@]}; do
echo 'processing' $id
grep -Rih --exclude-dir={reprocessing} --exclude=\*.sh $id >> '../result-test.dat'
done
echo 'end processing'
Answered By - user1131926 Answer Checked By - Mary Flores (WPSolving Volunteer)