I’m writing a simple shell in C and I want to implement the user input the same way the other shells do, or at least how bash does (never used others). If you enter a command with random whitespace then it can still run the command:
ex.
ls -1
Obviously strtok() wont work on this when separating the command and args…
How does bash do this? Should I search through the thousands of lines of the source code?
You can skip spaces while you’re parsing your command: