Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'How to Obscure Command Line Passwords' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to Obscure Command Line Passwords
Authored by: cyberdave on Jul 06, '10 05:01:20PM

Don't get me wrong, I love Perl and I use it all the time..but there's also 'the right tool for the job', and in this particular example, using a bit of Perl that consists basically of two system() calls and exporting an environment variable back to your shell is overkill when you can do all that without leaving the shell, with simpler code (at least to someone like me, who is comfortable with both shell scripting and Perl scripting).

Now, if I happened to have some Perl could that could interact with the Keychain more cleanly than dealing with the 'security' command and parsing it's output, then, yeah, I'd probably using that instead of a complicated bit of shell scripting (and I'd be arguing "hey, just do it in Perl!" if this was a hint showing the excessively complicated way).

But as far as this hint goes, which when I first read it, seems to really be about reading a password in the shell and assigning it to a variable without echoing your typing, I still say the shell version is better. Now, if you (not you personally) wanted to take this hint and expand on it and turn it into a more advanced tutorial (like 1: the basic method of how to read a password at the command line and store it in an environment variable, then 2: do the same thing in Perl, then 3: demonstrate how to do more advanced things in the Perl version, and 4: make it suitably generic (though the subject suggests otherwise, this one is really geared towards the Xgrid use case, and being able to use the same method elsewhere is added on somewhat as an afterthought) so everyone could see the different ways of doing it and choose the variation that's best suited for what they're trying to do, then we'd all be happy(er). :)



[ Reply to This | # ]