process-env

command module
v0.0.0-...-72046b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 13 Imported by: 0

README

process-env

process-env prints select environment variables of a process, typically the current user's desktop session, as shell commands to set those variables or as JSON. This is useful if you want to access an ssh-agent started for your desktop session in a remote session and in similar scenarios.

The default environment variables are as follows:

  • DBUS_SESSION_BUS_ADDRESS
  • DISPLAY
  • SSH_AUTH_SOCK

Installation

You will need Go 1.22.

go install dbohdan.com/process-env@master

Compatibility

process-env is known to work on:

  • FreeBSD 14
  • Linux
  • Windows 10

It is known to not work on:

  • macOS
  • NetBSD
  • OpenBSD

Usage

process-env [options] (pid|process-name) [var-name ...]

Options:
  • -f, --fish — output fish shell commands
  • -j, --json — output JSON
  • -p, --posix — output POSIX shell commands (default)

Examples

Get the default environment variables from a MATE session process using POSIX syntax:

process-env mate-session

Get only the DISPLAY environment variable from a KDE Plasma shell process using fish syntax:

process-env -f plasmashell DISPLAY

License

MIT. See the file LICENSE.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL