The following works with emacs26 on Ubuntu:
emacs file --eval "(add-hook 'emacs-startup-hook #'shell)"
Adding the function #'shell to emacs-startup-hook (instead of calling it with -f shell) defers the call to shell until the initialization of Emacs is complete.
That way the *shell*-buffer will be displayed in the window that is used for the *scratch* ...
The problem was in the .inputrc file (vi mode) with the following line:
As suggested in the jue's comment below, the following solves the problem by restoring the C-j to its original binding for dumb terminals such as the shell mode in Emacs:
Pass the command line option -f to run a function with no arguments, or --eval to run an arbitrary Lisp expression.
To run a shell (whichever comes last is the one that's displayed in the Emacs window):
emacs filename.txt -f shell
emacs -f shell filename.txt
Here are examples to split the window or open two frames.
emacs -f shell -f split-window-...