You can redirect input / output to /dev/tty. You will want to check if tty is accessible by isattymethods when you do such things.
For example, create ./test.shlike this
exec </dev/tty >/dev/tty
read -p "Enter text:" VALUE
echo "got: $VALUE"
And then
git submodule foreach ../test.sh
You will do the right thing, for example. in my testing
sehe@meerkat:~/custom/MONO$ git submodule foreach ../test.sh
Entering 'cecil'
Enter text:a
got: a
Entering 'glib'
Enter text:b
got: b
Entering 'gtk-sharp'
Enter text:c
got: c
...
sehe source
share