title: How to stop the current command only in a bash script?
body: <p>Suppose that <code>sleep 180</code> is a command that requires some time.
  I have a script that looks like this</p>
  <pre><code>#!/bin/bash
  echo &quot;Before sleep&quot;
  sleep 180 # I want to stop this
  echo &quot;After sleep&quot;
  exit 0
  </code></pre>
  <p>I want that, when the user press CTRL+C while <code>sleep</code> is executing, only this is terminated so that the user sees &quot;After sleep&quot;.</p>