read -rd '' とかはbash依存なんだよなぁ。。

read: 1: Illegal option -d