Skip to content

Instantly share code, notes, and snippets.

@thejhh
Created December 13, 2019 08:52
Show Gist options
  • Select an option

  • Save thejhh/71a4acbcb9919f89cde7c7d1bc7589e2 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/71a4acbcb9919f89cde7c7d1bc7589e2 to your computer and use it in GitHub Desktop.
Example of executing a NodeJS script with custom environment variables on all systems (supports both node and nodejs names for the executable)
#!/bin/bash
':' //; export TERMINAL_COLS="$(tput cols)"
':' //; exec "$(command -v nodejs || command -v node)" -- "$0" "$@"
const TERMINAL_COLS = parseInt(process.env.TERMINAL_COLS, 10);
console.log(TERMINAL_COLS);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment