Stack Exchange network consists of 178 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
View all activity pages
A possible solution (which certainly works for your small example):
# because File2.txt is bigger, it gets the main loop.
# read each line of File2.txt
while read string; do
# read ...