title: How can I detect that emacs-server is running from a shell prompt?
body: <p>I want to have my .bashrc detect if running emacsclient would work in lieu of running emacs.  Basically:</p>
  
  <pre><code>if emacs_server_is_running; then
      EDITOR=emacsclient
      VISUAL=emacsclient
  else
      EDITOR=emacs
      VISUAL=emacs
  fi
  </code></pre>
  
  <p>What would I put in the <code>emacs_server_is_running</code> function to accomplish this aim?</p>