I often execute a Perl script, which I cannot change, and it requires password to be passed as a command line argument in plaintext. For example:
$> perl myscript.pl -host localhost -user someone -pass topsecret -id 1,2,3,4
Without changing the myscript.pl, is there a trick which would enable me to avoid the password from showing up on the screen and in the command history? I would love to simply pass -p and then get prompted for password later with echo off mode as happens with mysql command:
$> mysql -hlocalhost -usomeuser -p -- mydb
Enter password:
Or some trick that would change whatever I type to appear as asterisks, for example:
$> perl myscript.pl -host localhost -user someone -pass ***** -id 1,2,3,4