Originally Posted By: Virtual1
Try not to think of all that stuff around it as "unnecessary", consider it instead to be "robust" wink Remember, I don't code for myself, I code for everybody.

I get that part. By 'unnecessary/overdone' i meant stuff like (as mentioned earlier) the dscl method of determining if the operator is an admin. The id approach is so much simpler [only two calls to id and one pipe to grep (as opposed to calling dscl, cut, echo and two greps involving three pipes, plus storing some "$admins" variable which never gets used again).] But even (as also mentioned earlier) the whole authorization step itself... it isn't actually needed, is it?

Also (as mentioned earlier) the scheme of employing the pl array that doesn't seem to offer any advantage (which indexed array access normally does), while simultaneously requiring the code [and its author] to spend energy laboriously "dereferencing" the items stuffed into that array throughout the rest of the script. Seems rather superfluous to me.

As for placing an executable script in /var/tmp/ —beyond being unnecessary —it could also be considered risky business (fodder for haxors). Normally such items would be created using mktemp (to randomize its name), and never be given world access (via chmod +x) as was done. Go with chmod u+x at least.

In the end however, that external script isn't needed. That is what this thread was all about in the first place. Thus your comment (and the fact that your script didn't adopt a single suggestion i've made) really floored me.

But hey, other readers can still benefit. So be it.