Socket
Socket
Sign inDemoInstall

shell-env

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell-env

Get environment variables from the shell


Version published
Weekly downloads
11K
increased by9.41%
Maintainers
2
Weekly downloads
 
Created
Source

shell-env

Get environment variables from the shell

Especially useful for Electron apps as GUI apps on macOS doesn't inherit the environment variables defined in your dotfiles (.bash_profile/.zshrc/etc).

Install

$ npm install shell-env

Usage

import {shellEnv} from 'shell-env';

console.log(await shellEnv());
//=> {TERM_PROGRAM: 'Apple_Terminal', SHELL: '/bin/zsh', ...}

console.log(await shellEnv('/bin/bash'));
//=> {TERM_PROGRAM: 'iTerm.app', SHELL: '/bin/zsh', ...}

API

Note that for Bash, it reads .bash_profile, but not .bashrc.

shellEnv(shell?)

Return a promise for the environment variables.

shellEnvSync(shell?)

Returns the environment variables.

shell

Type: string
Default: User default shell

Shell to read the environment variables from.

  • shell-path - Get the $PATH from the shell
  • fix-path - Fix the $PATH on macOS when run from a GUI app
  • shell-history - Get the command history of the user's shell

Maintainers

Keywords

FAQs

Package last updated on 13 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc