Hacker News new | ask | show | jobs
by cfiggers 733 days ago
You could have a shim script with the shebang that only exists to call the "real" script using Python.

/usr/bin/hello:

  #!/usr/bin/bash
  python3 /usr/bin/hello.py
/usr/bin/hello.py:

  print("Hello, world!")
Console:

  $ chmod +x /usr/bin/hello
  $ hello
  Hello, World!
1 comments

Why is this response being marked down? Just off the top of my head Sublime and VSCODE do this. I prefer `/usr/local/bin` since your package manager won't touch it.

Sublime:

  /usr/bin/subl:
  #!/bin/sh

  exec /opt/sublime_text/sublime_text "$@"
VSCODE:

  /usr/bin/code:
  ...
  # Launch
  exec /opt/visual-studio-code/bin/code "$@" $CODE_USER_FLAGS