You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

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

4.0.1
latest
Source
npmnpm
Version published
Weekly downloads
26K
-2.04%
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

env

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