Answer the question
In order to leave comments, you need to log in
How does bash terminal parse a command and what parameters to pass to it?
Hello!
Are there source codes or code examples somewhere on how to create your own command line interface emulator, preferably in PHP? I don't mean a PHP file that passes parameters to the command line. I'm interested in the algorithm itself, how BASH saves aliases, parses parameters, etc. to reproduce something similar in PHP. All that I managed to find was reading the parameters with which the PHP script was launched or how to get the parameters in *.sh. And I would like to see the algorithm of the work of this command itself. Thanks for any link/information!
Answer the question
In order to leave comments, you need to log in
You won't make a full-fledged bash, don't even try, bash is a full-fledged scripting language, when you reach the level of developing the simplest scripting language, you will no longer have such questions, and the need for this will disappear.
As for parsing the arguments of a separate command, everything is on the conscience of the application that this command launches, bash passes all the arguments simply as a string
I'm interested in the algorithm itself, how BASH saves aliases, parses parameters, etc. to reproduce something similar in PHP.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question