When use sudo -i
I will simulate login as root, and current working directory will be jumped to /root.
Is it possible not to jump and keep the working directory unchanged?
When use sudo -i
I will simulate login as root, and current working directory will be jumped to /root.
Is it possible not to jump and keep the working directory unchanged?
Do you need to simulate an initial log in, you can use
sudo -s
to just get a root shell.-s option does not allow me to run commands which can be found only after user login (PATH is updated in the .bash_profile)
Answer 'Joel K' is cause of error. So correct way is:
Use your own command instead of echo.