WSL Interop PATH customization

Viewed 308

I have an Ubuntu-18.04 WSL instance installed and have a large set of scripts installed in it at /home/username/bin/scripts.

I have also updated the $HOME/.bashrc, $HOME/.bash_profile, /etc/bash.bashrc, /etc/profile and /etc/environment files to update $PATH to include /home/username/bin/scripts in the path.

*I'm well aware i only usually need it in my $HOME/.bash_profile, lots of places from experimenting

Say I have a script called sampleScript in /home/username/bin/scripts, when i try to run the command:

wsl sampleScript

It gives the error: /bin/bash: sampleScript: command not found

If I open up wsl in interactive mode I can run it just fine, but I would like to be able to expose the script to not be run in interactive mode.

I've tried making an environment variable SPATH='/home/username/bin/scripts' and setting WSLENV=SPATH/p, but it also does not show up if i do wsl echo $PATH.

*I'm doing this all in command line instead of powershell b/c powershell doesn't appear to be able to do wsl echo $PATH at all, it just returns empty

I have also tried: wsl -u username sampleScript; with no luck

Is there a way to customize the PATH for wsl interop mode or am i doing something incorrectly with WSLENV?

0 Answers
Related