title: Can I have two shebang lines, one for python and one for python3?
body: <p>I have a script that I am running on multiple Linux OSs. The shebang line of my script is: </p>
  
  <p><code>#!/usr/bin/python</code></p>
  
  <p>When I came across CentOS 8, this doesn't work as I get the following:
  "-bash: ./sysinfo-snapshot.py: /usr/bin/python: bad interpreter: No such file or directory"</p>
  
  <p>And as a workaround I can change the shebang line to </p>
  
  <pre><code>#!/usr/bin/python3
  </code></pre>
  
  <p>and this would 100% solve the issue.</p>
  
  <p>However, what I'm looking for is to have my script try the first shebang line, and if it didn't work, to try the second line, as in, 2 first lines in the code would be:</p>
  
  <pre><code>#!/usr/bin/python
  
  #!/usr/bin/python3
  </code></pre>
  
  <p>Is this possible?
  Is there a way to support both python and python3 for the script? As in first try the first shebang line, if it didn't work try th second line.</p>
  
  <p>Things I tried to far:
  I tried changing the shebang line to: <code>#!/usr/bin/env python</code>
  But it didn't work.</p>
  
  <p>Thanks</p>