Sorry, I don't want to give further information about it
I don't think that's up to the point to solve the problem, because it hasn't to do with this.... Anyway, I have to say that the program was working fine. Only when root user ran it twice then the output was full of errors (because then it couldn't overwrite the files and the folder that were created). One solution is to force-copy the file (overwrite the existing) but i want to avoid the script to do all this searching to collect info about each user and then to overwrite the already existing folders and files. I wanted to avoid this and then I tried to make this code in case the user is root to recognize if there is any folder or file with a user's name in the same folder and then run something else immediately.... it is simple.
The program runs something if there information isn't there and then runs the ./runit
If the things that wanted to collect are there then avoid collecting the info and run .runit immediately! Simple...
The thing is that I cannot locate my error!