title: Using `touch` command, recognize file type and auto-generate shebang?
body: <p>So, I really like the fact that text editors such as <a href="http://vim.wikia.com/wiki/Shebang_line_automatically_generated" rel="nofollow">Vim allows you to auto-write text (most of the times shebangs) when creating a new file with a specific file extension</a>.</p>
  
  <p>However, I'd like to know if there's any way to do it from the terminal using the <code>touch</code> command.</p>
  
  <p>For example, I want to auto-generate shebangs for my Python script I just created from the terminal, like below:</p>
  
  <pre><code>$ touch test.py                   # create file and auto-generate
  $ cat test.py                     # see the contents to confirm
  #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  </code></pre>
  
  <p>I know I can just create a bunch of auto-generating text variables in my environment such as <code>PY_SHEBANG="#\!/usr/bin/env python\n# -*- coding: utf-8 -*-"</code> and just do:</p>
  
  <pre><code>$ echo $PY_SHEBANG &gt; file.py
  </code></pre>
  
  <p>But the thought of going through so much trouble just messes with my head.</p>
  
  <p>That being said: <strong>is there any way to configure the terminal/shell so that it can recognize the filetype of the file I'm creating, and append text to it automatically based on filetype, with a single</strong> <code>touch</code> <strong>command?</strong></p>
  
  <p><em>NOTE: I am using zsh and oh-my-zsh.</em></p>