I've created a new Laravel application using docker and Laravel Sail. I've used Ubuntu on my Windows 11 computer to store my application using sail. Everything works as intended and I can access my application.
The problem I'm experiencing is that every time I need to run Laravel Sail commands I need to type in the full path: ./vendor/bin/sail (command)
. I know the way to add a bash alias is the following:
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
The issue is that every time I open up Ubuntu using my Windows terminal, or reset my computer, this alias is gone. I'll have to re-apply the command into the terminal to use the alias again, until the next computer refresh.
How can I make sure this bash alias sticks, instead of having to type this out every single time I have to restart my computer?
You can add alias depending on the terminal you're using, If you're using zsh
or bash
If zsh then run
nano ~/.zshrc
and then add alias - alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
source ~/.zshrc
if you are using bash
run in your terminal
nano ~/.bash_profile
and then add alias - alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
,
source ~/.bash_profile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With