Q: How can I insert variable $b to a truly random place in variable $a?Example INPUT variable content: $ echo $arvztr tkrfrgp$ echo $bZZOUTPUT$ ./somemagicscript.shrvztr tkZZrfrgp$ ./somemagicscript.shrvztr tkrfrZZgp$ ./somemagicscript.shrvztrZZ tkrfrgp$ ./somemagicscript.shrvztr tZZkrfrgpUPDATE: The current answers are not perfectly good since under OpenBSD it sometimes places a  character besides the inserted variable. :\Maybe than when the inserted variable is next to a multi-byte character..
How to insert a variable in a variable in a random place?
bash;sed;perl;ksh