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.
sudo -i "cd `/bin/pwd` ; /bin/bash"
-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:
sudo -i -- bash -c "cd '$PWD'; echo"
Use your own command instead of echo.