I'm using pwgen in a bash script. For security, we have to use the -y flag to include at least one special character. However, this frequently returns passwords with one or more of ` or " which break the surrounding script.
Can I prevent these characters being generated? If not, what's the cleanest way to remove, replace or otherwise sanitize pwgen's output to exclude these characters?
My current pwgen is;
intPW=$(pwgen -c -n -y -B -1 15)
which means intPW's value could be something like;
iqui`c:ee4so4Ch
hph7eew"ohr9Ee
I need to guarantee that every password has a symbol in it, just not one of the problematic symbols.
Anything I can think of in terms of replacement, from an if loop to a sed, breaks because I'm trying to target a backtick.