2 dont need the output
source | link

You can use emacsclient itself to test if there is a connection:

#!/bin/sh
if ! emacsclient -e 0  2>>&/dev/null
then emacs --daemon
fi
emacsclient -c "$@"

-e 0 means evaluate the expression "0", which just prints 0. The return code is non-zero if emacsclient fails to connect to the server.

You can use emacsclient itself to test if there is a connection:

#!/bin/sh
if ! emacsclient -e 0  2>/dev/null
then emacs --daemon
fi
emacsclient -c "$@"

-e 0 means evaluate the expression "0", which just prints 0. The return code is non-zero if emacsclient fails to connect to the server.

You can use emacsclient itself to test if there is a connection:

#!/bin/sh
if ! emacsclient -e 0 >&/dev/null
then emacs --daemon
fi
emacsclient -c "$@"

-e 0 means evaluate the expression "0", which just prints 0. The return code is non-zero if emacsclient fails to connect to the server.

1
source | link

You can use emacsclient itself to test if there is a connection:

#!/bin/sh
if ! emacsclient -e 0  2>/dev/null
then emacs --daemon
fi
emacsclient -c "$@"

-e 0 means evaluate the expression "0", which just prints 0. The return code is non-zero if emacsclient fails to connect to the server.