Liking my script is immaterial -- anything that actually does the job is good enough. Style is a personal thing. For instance, I haven't used the backtic version of running a command in years; so what?eloyd wrote:I do not like your script.
It makes assumptions.
It's also not temp file safe.
Will work in all cases where "useradd" exists.
Not sure what the"assumptions" you are talking about, but everything has to assume something.
I could replace the line creating the fname variable with, which could make it more "temp file safe." This script was pulled together from my larger script, which makes sure there is not another copy running at the same time, so the way I did it is good enough. So the style I used made sense in the grand scheme of things, perhaps not so much in this small example. There are very real style differences between minimalist quick-and-dirty scripts and those hardened for production work.
Bottom line, my example worked, or, at least, showed something that could be incorporated into the larger process.
The current installation script does not work properly. However the current installation script gets fixed so it does not tank the entire installation simply because the user exists outside of the current /etc/passwd or the group exists outside of the current /etc/group, then I'm okay with it. I was asked for a suggestion, I offered one.