I have a bash script that takes a wikipedia URL as an argument (wiki_txt_script.sh) and takes text from the page using wget. When called with the -r option it prompts the user whether they want the text from any of the pages linked from within the text, putting the chosen URLs into a temporary file, one URL per line. I've created a loop to recursively call the script on each URL in order to get the text from those pages as well:
while read line; do
echo $line
wiki_txt_script.sh -w $line
echo finished a recursive call
done <temp_links.txt
This however only seems to loop through once, getting the text successfully from the first URL in temp_links.txt (and still performing the echo command in the loop after the recursive call), but the loop then ends, not calling the other lines of temp_links.txt. Removing the recursive call from the loop causes it loop through each line and echoes the contents as expected. What is causing the loop to end early when a recursive call is present?
Edit: Charles' answer solved my problem. After using the script with dev/null however, each line of output to the terminal began at the end of the last line of output to the terminal. This continued with other commands once the script was finished and appeared as so:
Strange command line appearance
Which would simply go away once I started a new session. Any thoughts on why this occurred?