I'm attempting to read lines from a file and run some commands based on that file. However, only the first line of the file is read and nothing else is done. There are no error messages displayed, it seems as though the do while loop is ignoring the subsequent lines.
The contents of the file are file paths. I was able to get it to work in another fashion, but it gave me too much 'garbage' data and took longer to run as a result.
Example contents:
Users/username/rest/of/the/file/path/
Users/username/rest/of/the/file/path/
Users/username/rest/of/the/file/path/
Here is the problematic loop:
githubRepoList='githubcomparerepo.txt'
echo Start First Tag Check
while read l; do
cd ~
echo $l >> ~/testcsvtag1.txt
cd $l
pwd
find $l -type f -name "*.csv" >> ~/testcsvtag1.txt
printf "\n" >> ~/testcsvtag1.txt
done < $githubRepoList
The loop that works looks like this:
find / -name "l10n" >> l10n.txt
cat l10n.txt | grep github > l10n1.txt
filename='l10n1.txt'
echo Start
while read l; do
cd ~
echo $l >> ~/testcsvtag1.txt
cd $l
pwd
find $l -type f -name "*.csv" >> ~/testcsvtag1.txt
printf "\n" >> ~/testcsvtag1.txt
done < $filename
Some of the contents of the loop is just to monitor where it's at while I'm writing this script and for error checking, such as the cd ~
and pwd
commands.