I have never used PHP with CLI, but I have seen scripts running with PHP code.
I was wondering:
- Why should we use BASH, when PHP is so popular and is able to run in CLI?
- What are the pros and cons with each one?
- Should I use PHP for all CLI scripting in the future?
It is still much easier to perform many common tasks in bash. Consider writing PHP equivalents for the following bash one-liners: