bash - Automatically chdir to vagrant directory upon "vagrant ssh" -


so, i've got bunch of vagrant vms running flavor of linux (centos, ubuntu, whatever). automatically ensure "vagrant ssh" "cd /vagrant" no-one has remember whenever log in.

i've figured out (duh!) echo "\n\ncd /vagrant" >> /home/vagrant/.bashrc trick. don't know how ensure happens if cd command isn't there. i'm not shell expert, i'm confused here. :)

cd bash shell built-in, long shell installed should there.

also, aware ~/.bash_profile interactive login shell, if add cd /vagrant in ~vagrant/.bashrc, may not work.

because distros ubuntu not have file -> ~/.bash_profile default , instead use ~/.bashrc , ~/.profile

if creates ~/.bash_profile vagrant user on ubuntu, ~vagrant/.bashrc not read.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -