I'm trying to do something like this:
sudo su <<EOF select x in a b c; do echo "Selected $x"; break; done EOF
However, it terminates without accepting input.
It works if I do this:
sudo su -c 'select x in a b c; do echo $x; break; done'
But it's nicer writing longer scripts with heredoc (yes I know it's nicer still to put them in a file).
I'm sure this is answered in various places, but I can't seem to hit the right bash/heredoc/tty/stdin search term combo.
Is there any way to achieve this?