title: Vim exec command in command line, and Vim: Warning: Input is not from a terminal
body: <p><strong>vi.sh</strong></p>
  
  <pre><code>vim -c "set ft=unix" -c "x" $1
  </code></pre>
  
  <p><strong>main.sh</strong></p>
  
  <pre><code>sh vi.sh file1
  sh vi.sh file2
  </code></pre>
  
  <p>If I exec <code>sh vi.sh file1</code> or <code>sh main.sh</code>, there is no warning.</p>
  
  <p>But if I exec <code>cat main.sh | sh</code>, it would give:<code>Vim: Warning: Input is not from a terminal</code>.</p>
  
  <p>What is the difference? How can I dismiss this warning message when I run <code>cat main.sh | sh</code>?</p>