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
Post a Comment