Is it possible to execute a read inside a git foreach?
git submodule foreach 'read -p "test"; echo $REPLY'
does not work at all as the read gets the input from git itself - which is the objname and hash here. Is there any chance to read interactively of the console?
You can if you redirect input/output to /dev/tty. You will want to check whether a tty is available with isatty based methods first when you do this kind of thing.
E.g., create a ./test.sh like so
exec </dev/tty >/dev/tty
read -p "Enter text:" VALUE
echo "got: $VALUE"
And then
git submodule foreach ../test.sh
Will do the right thing, e.g. 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
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With