The following command works to open a file in an existing emacs instance:
emacsclient --eval \
"(progn (find-file \\"/a/b.txt\\") (goto-line 1) (forward-char 2) (recenter))" \
--no-wait \
--alternate-editor=emacs
However when there is no emacs instance running it creates a buffer called b.txt")
.
Is there a way this can be made to work in both cases?