title: How to run a pkill when invoking a shell to execute a string of commands?
body: <p>To automate a system administration task, I wrote down the following line of shell code:</p>
  
  <pre><code>bash -c 'pkill -TERM -f java; true'
  </code></pre>
  
  <p>The problem is that pkill kills the bash immediately after the <code>pkill</code> command executes, and therefore subsequent commands do not have a chance to execute.</p>
  
  <p>Apart from splitting the them into two lines:</p>
  
  <pre><code>bash -c 'pkill -TERM -f java'
  bash -c 'true'
  </code></pre>
  
  <p>Is there any other workaround?</p>