string replacement turns out not POSIX compliant

http://mywiki.wooledge.org/Bashism