sedの解が出てるんだからそれを呼べばよいのでは。
何も無理してshだけで文字列操作するこたーないと思うけど。
#!/bin/sh
f () { local l; read -r l && { f; echo "$l"; }; }
f