Not a direct answer to your question, but maybe this is a solution for you.
M-x install-package shell-pop
To install the package shell-pop from melpa or melpa-stable.
Then evaluate (for tryout in *scratch*
via C-x C-e
, later in your .emacs
)
(global-set-key (kbd "<C-M-return>") 'shell-pop)
This pops up a shell in the lower part of your frame, in this case when pressing ctrl-meta-ret. Repeating the keyboard sequence returns back where you were.
See https://github.com/kyagi/shell-pop-el for details.