How bash parses a command terminal and what options should I tell her?

Zdravstvuite!
Is there somewhere a source code or code examples how to create your emulator command line interface, preferably in PHP? I do not mean a PHP file which passes parameters on the command line. I am interested in the algorithm as BASH aliases saves, parses the settings etc to recreate something similar in PHP. All I've managed to find is the read parameters with which start a PHP script or in *.sh to obtain the parameters. And I would like to see the algorithm works in fact of this team. For any link information - thank you!
July 9th 19 at 12:53
2 answers
July 9th 19 at 12:55
Solution
Complete bash You do, don't bash - complete scripting language, when You get to the level to develop a simple scripting language, You have such question will not arise, and the need for it will disappear.
About parsing arguments of a single command, everything is on the conscience of the application that this command runs bash passes all arguments is just a string
I don't need a full-fledged scripting language (Among other things - thank you for this query found more useful information). I need something simpler. Most likely I need only: the parser strings, a static class with a list of commands and parameters that the class of alias - this is how I see it. About the BASH I was asked to possibly borrow something from the algorithms of the parser architecture. - paige commented on July 9th 19 at 12:58
July 9th 19 at 12:57
I am interested in the algorithm as BASH aliases saves, parses the settings etc to recreate something similar in PHP.

Well, it is necessary to do the cycle in which to take the input one line at a time, and if you enter a string to parse it into components and keep the parts you need into the hash table (if about aliases speech). In bash'e aliases also need to write to a file that runs on each boot of the interpreter. No, actually, there are some secret places, they just loaded into memory and sitting there.
I figured it out. Thanks for the response! Now yet another problem - the regular season) - paige commented on July 9th 19 at 13:00

Find more questions by tags AlgorithmsPHPProgramming