I'm fairly new to Linux and shell scripting.
My problem is, that the script should read 2 tokens from a file called "list" - using these tokens, it creates a user and depending on the second token, a sub folder. It does this just fine - but only once. Only ONCE. Is there a problem with my WHILE loop?
Here is a few sample lines from "list":
egyes n
kettes y
harmas y
Here's the script:
#!/bin/bash
echo " " >> /root/userpass.txt
most=$(date)
while read user rr; do
p1=${user:0:2}
p2=${user:3:4}
pass=$p1$RANDOM$p2
echo $user - $pass --" LÉTREHOZVA: "$most >> /root/userpass.txt
adduser $user > /dev/null
echo $user:$pass | chpasswd > /dev/null
uhome=/home/$user
if [ $rr=="y" ]; then
mkdir $uhome/rockandroll
chown $user $uhome/rockandroll
fi
mkdir $uhome/res-devres
chown $user $uhome/res-devres
ftpc=/etc/proftpd/proftpd.conf
echo "#"$1 >> $ftpc
echo "<Directory "$uhome"/res-devres/>" >> $ftpc
echo ' <Limit CDUP XCUP STOR LIST CWD XCWD STOU>' >> $ftpc
echo ' AllowAll' >> $ftpc
echo ' </Limit>' >> $ftpc
echo ' <Limit RETR DELE>' >> $ftpc
echo ' DenyAll' >> $ftpc
echo ' </Limit>' >> $ftpc
echo '</Directory>' >> $ftpc
echo " " >> $ftpc
echo " "
done < list
Thanks in advance.