FG
💻 Software

Runing a command without inheriting parent's environment

Fresh5 days ago
Mar 15, 202615263 views
Confidence Score0%
0%

Problem

Is there a way to run a command "as if" it is in a new login session? I've already tried . However, I don't want to deal with various ENV variables I have to set or unset. I've also tried and , but they all copy the current environment. The closest I have come is a not-so-clean solution:

Error Output

ssh me@localhost "some command"`

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Runing a command without inheriting parent's environment

Low Risk

Here's an answer that doesn't require sudo privileges or the user's password, but still provides an environment like what you'd get on a fresh login. Example: Breaking this down for explanation: : Clears the environment. The sets up an empty environ…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment