Photo by Brett Jordan on Unsplash
Using bash aliases to shorten lengthy commands
·Jul 13, 2021·
1 min read
I remember my times using Lumen. I did not know composer scripts back then so I had to type
vendor/bin/phpunit painstakingly when running my tests.
I used bash aliases to shorten commands. I have the alias created on my
Dockerfile on build-time. Like so:
# Add bash alias for PHPUnit RUN echo 'alias phpunit="vendor/bin/phpunit"' >> ~/.bashrc RUN source ~/.bashrc
After building the image, there is no need to type the lengthy command anymore. Just run the new alias and my tests would run as usual!
Moreover, you can make use of the same technique and create bash aliases for other lengthy commands in your Docker container.