PATH variable - strange behaver.

Hi everybody!!

i am installed the openSUSE 11.2 from scratch.
now i see something strange goes here…
when i ran the command: “sudo init 3”, i got the error:
“sudo: init: command not found”

so i checked the PATH variable and didn’t saw /sbin in there, so i added it.
after that i could run init as normal.

but the strange thing here, that after restarting the system i saw that all the change i did to the PATH variable are gone… :frowning:

What is the problem, how can i solve this issue?

Thank you very much!

You should do

sudo -i init 3

This will give you a login shell (for root) and thus the startup scripts of the root login shell and thus the correct initialized PATH variable for root (which is different from the one initialized for you). See the man page of sudo.

Also, as every variable in the environment, the PATH variable belongs to a process (the bash you are running in this case). As soon as that process halts, it is gone. In this case: as soon as you log out it is gone. Let alone when you reboot the system.