title: How to suppress output in Google Colaboratory cell which executes a command line script (line starts with `!`) via a function
body: <p>In Google colab I execute command line scripts by place a <code>!</code> in front of the line and executing the cell. </p>
  
  <p>For example </p>
  
  <pre><code>!pip install adjustText
  </code></pre>
  
  <p>If I want to prevent output of this cell, I can do this</p>
  
  <pre><code>%%capture
  !pip install adjustText
  </code></pre>
  
  <p>However, I have a situation where I execute the command line scripts via a function, and suppress output for that command line only, without suppressing the output of the cell from which it's being executed</p>
  
  <p>For example</p>
  
  <p>Cell1:</p>
  
  <pre><code>%%capture
  def installAdjust():
      !pip install adjustText
  </code></pre>
  
  <p>Cell2:</p>
  
  <pre><code>for v in range(10):
      print(v)
      installAdjust()
  </code></pre>
  
  <p>This does not suppress the output from <code>!pip install adjustText</code>. I do not want to suppress the non-command line output from Cell2, so I can Not do this</p>
  
  <p>Cell2:</p>
  
  <pre><code>%%capture
  for v in range(10):
      print(v)
      installAdjust()
  </code></pre>
  
  <p>Also, this doesn't work either</p>
  
  <p>Cell1:</p>
  
  <pre><code>def installAdjust():
     %%capture
      !pip install adjustText
  </code></pre>