bash
there isn't a keyword, it's a command being executed. It's being passed the argument /dev/fd/10
. The shell running the script (which may or may not be bash) is setting up a heredoc to be read from file descriptor 10.
So, bash is being invoked to run the heredoc as a shell script. It's similar to if the line read bash /path/to/script.sh
— in this case, the script is just coming from a heredoc instead.
Why someone did that (instead of just using ( commands )
is impossible to answer without the context (and possibly the history as well). One guess (as DopeGhoti suggests) is that the script may be running under a different shell, and that bit requires bash. Another possibility is that the script's author just didn't know the alternate methods.
As to why FD 10 is used instead of stdin, it could be because the script block needs to read from stdin as well.
fish
,tcsh
,ksh
, et cetera), you're not already in Bash, so you may need to explicitly invoke the shell in case you're currently in one that does not support heredocs. – DopeGhoti Mar 22 '17 at 16:38