Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No /etc/profile or ~/.bashrc env vars available when executing a command as "wsl <cmd>" #10784

Closed
1 of 2 tasks
KarelChanivecky opened this issue Nov 17, 2023 · 3 comments
Closed
1 of 2 tasks

Comments

@KarelChanivecky
Copy link

KarelChanivecky commented Nov 17, 2023

Windows Version

Version 10.0.19045.3693

WSL Version

2.0.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

SETUP
1- In distro, add env var to /etc/profile. Example: export VAR1=1
2- In distro, add env var to ~/.bashrc. Example: export VAR2=2

TEST 1
1- enter the distro using "wsl" cmd
2- Run "env" cmd

TEST 2
1- from Windows command line run "wsl env"

TEST 3
1- from Windows command line run 'wsl bash --login -c "env"'

Expected Behavior

TEST 1
Both variables are present in the environment.
* The .bashrc var is expected, as the SHELL env var states that bash is the current shell, at least in my distro

TEST 2
Both variables are present in the environment.
* The .bashrc var is expected, as the SHELL env var states that bash is the current shell, at least in my distro

TEST 3
Both variables are present in the environment.

Actual Behavior

TEST 1
Both variables are present in env.

TEST 2
Neither variable is present in env.

TEST 3
Only the var set in /etc/profile is present in env

Diagnostic Logs

No response

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

You can give me feedback by thumbs upping or thumbs downing this comment.

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 17, 2023

/dupe #7861

@OneBlue OneBlue closed this as completed Nov 17, 2023
Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.

Thanks for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants