I'm running a ksh script on AIX 7.2.
In debug mode I want to redirect all the script does to a brkpt-file.
The script also makes logins to another application and therefore uses a password (let's say "pw123_")
exec > $brkpt_file 2>&1 set -xv dsmadmc -id=admin -pa=pw123_ q pr
Redirection works fine, but I want to replace the passwordstring with "***" so its never visible in the brkpt-file.
That works fine on commandline:
echo "dsmadmc -id=admin -pa=pw123_ q pr" | sed "s/-pa=[[:graph:]]* /-pa=*** /g" result dsmadmc -id=admin -pa=*** q pr
But as soon as I use this "sed" in combination with "exec":
a) the output is not redirected to file anymore but on the screen
b) the passwordstring is not replaced
exec | sed 's/-pa.*=[[:graph:]]* /pa=*** /g' > $brkpt_file 2>&1 set-xv dsmadmc -id=admin -pa=pw123_ q pr result + dsmadmc -id=admin -pa=pw123_ q pr + ... other stuff of script
How I can I get all the script stuff in the brkpt AND hide the password?