Making a very basic shell given as assignment.
Assuming I have a string "ls a b c | grep a"
How can I get something like this
commands[0][0] = "ls"
commands[0][2] = "a"
commands[0][2] = "b"
commands[0][3] = "c"
commands[0][4] = NULL
commands[1][0] = "grep"
commands[1][1] = "a"
commands[1][2] = NULL
First split on "|" and then split further on spaces
and hence be able to execute execvp(commands[0][0], commands[0])
I can do single splitting just fine but this double splitting is somewhat troublesome
I have not tested with execvp
output: