Shell: Allow empty tokens if enclosed in single or double quotes

Previously the shell parser would discard empty tokens. We now allow
them when they are enclosed in quotes (either '' or "")

This means that a command like _echo ""_ will actually pass an empty
string to /bin/echo in argv[1] now.
This commit is contained in:
Andreas Kling 2020-01-25 12:16:45 +01:00
commit ed90d39cd7
Notes: sideshowbarker 2024-07-19 09:50:25 +09:00
2 changed files with 6 additions and 5 deletions

View file

@ -67,7 +67,8 @@ public:
Vector<Command> parse();
private:
void commit_token();
enum class AllowEmptyToken { No, Yes };
void commit_token(AllowEmptyToken = AllowEmptyToken::No);
void commit_subcommand();
void commit_command();
void do_pipe();