Greetings,
it's look like i have a mistakes on my understanding of loop in bash shell. I write a simple script but, it always repeat the first variable and soon, in every text it made.
Code:
#!/bin/bash
username=/tmp/username.txt
emailadd=/tmp/emailadd.txt
while read list; do
while read name; do
echo "Hello $read" >> /tmp/$list.txt
done < $username
echo " your email is $list" >> /tmp/$list.txt
done < $emailadd
my goal is to create each .txt file with a name of a user, contains a name and an email address on his body text;
Hello user1
your email is email1
while i get with above code is, it creating each user email address.txt with every line of username printed.
Hello user1
Hello user2
your email is email1
I am really appreciate your help.