Ubuntu 16.04.5 LTS Windows10 Vagrant
This is fine for running Rails on a Mac environment,
rails s
In the Vagrant environment, commands are troublesome like this.
rails s -b 192.168.33.10 -p 3000
You can search from the history and **! **, but I want to move it more quickly.
history | grep 33.10
Open **. Bashrc ** with ** vi ** and move to the bottom with ** Shift + g **.
vi ~/.bashrc
Add the following function
function rails () {
if [[ "$@" =~ ^s$ ]]; then
command rails s -b 192.168.33.10 -p 3000
else
command rails "$@"
fi
}
Reflect the changed .bashrc.
source ~/.bashrc
With ** rails s **, ** rails s -b 192.168.33.10 -p 3000 ** worked.
c'est fini :grin::clap:
Recommended Posts