I am a beginner and I am wondering if I can get help with this, please. The code should read one line from a file, display it, meet a condition, and then move on to the next line and repeat for as many lines as are in the file. I have been able to come up with a way to do this but this would be better if it was a loop instead. This is what I have so far
output=$(cat urls.txt | sed -n '1p')
read -p "Store $output y or n ?" deci
if [ $deci == "y" ];
then
sed -n '1p' urls.txt >> saved_domains.txt
fi
output=$(cat urls.txt | sed -n '2p')
read -p "Store $output y or n ?" deci
if [ $deci == "y" ];
then
sed -n '2p' urls.txt >> saved_domains.txt
fi
And this goes on, line by line