bash - how to change directory from inside unix shell -




change(){ read -p "enter username" q sudo su $q cd /home/$q pwd  } change 

without using sudo able change directory, when sudo su, cd not work ? possible reason behind , solution

when run sudo su $q, logging in $q. then, script waits until sudo su command exits, before continuing execute. rest of script execute after type exit-- including change of directories.

if wish su end in different directory, first change directory, , then run sudo su command.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -