in reply to Modifying command line

Rather than doing that, I'd suggest putting the DB connect string into a config file or environment variable. Then your program could get the information it needs, no one else will see it in a ps, and you won't have to work deep, dark magic on *nix.

But then, I'm a coward...

Replies are listed 'Best First'.
Re^2: Modifying command line
by quester (Vicar) on May 11, 2008 at 22:06 UTC
    A config file would be a better idea than an environment variable. (Be sure your config file has 0400 permissions!)

    Environment variables are not always safe. For example, both Solaris 8 and 9 and Linux 2.6 have needed patches to keep other users from examining the contents of other users' environment variables.

Re^2: Modifying command line
by horrendo (Sexton) on May 11, 2008 at 21:50 UTC
    Thanks apl. I already do that. The command line is just one of several ways to get the info into the program. It is not the "recommended" way however for the casual user it is the most convenient.

    I was hoping it was as easy to manipulate the entire command line string as it is to manipulate $0, but if someone can suggest an approach - even if a degree of magic is involved, I'm willing to give it a go.

    Thanks again.