6

enter image description here

I have added a path in bashrc, still, the command is not found. When tried in ubuntu it worked but not in WSL. Why this happen?.

export PATH=\wsl$\Ubuntu\usr\local\mbdyn\bin:$PATH

added same path in .bashrc

error: command not found

**Please see the attached image

juliomalves
  • 42,130
  • 20
  • 150
  • 146
Jithinraj
  • 71
  • 1
  • 1
  • 4
  • 2
    Welcome to Stack Overflow. Please note that questions here should be about "*specific coding, algorithm, or language problems.*" Please consider posting questions like this on [Unix & Linux Stack](https://unix.stackexchange.com) or [Super User](https://superuser.com) in the future. Short answer, though, your path is incorrect in at least two ways - Linux paths use `/`, not `\`. And you should start from `/usr/` since that's the Linux path. – NotTheDr01ds Feb 21 '21 at 23:09

2 Answers2

9

As you have been told, the forward slash to use is / and if you use the command

PATH="$PATH:/folder/subfolder/" 

that value will only last in the PATH for the duration of the session. To include a value in the PATH permanently, edit the .bashrc file from your home

$ sudo vim ~/.bashrc

you add at the end

export PATH="$PATH:/folder/subfolder/"

you save and you will have that value in the PATH in each session

Andres Robles
  • 125
  • 1
  • 9
  • 1
    This should be the answer given its extra details which enforces the path each time we load linux – John Stud Dec 19 '22 at 01:25
  • It didn't work for me. There was no .bashrc file so I had to create it, after which I followed similar instructions. Here's the version I'm using `$ bash --version` `GNU bash, version 4.4.12(0)-release (i686-pc-cygwin)` – random Aug 29 '23 at 17:20
0

You will need to modify the PATH variable as follows:

PATH="$PATH:/usr/local/mbdyn/bin"
Raman Sailopal
  • 12,320
  • 2
  • 11
  • 18