Hi,
I wrote a shell in C that accepts commands.
Now I need to implement input output redirection.
My shell accepts a string and breaks it down to command and file name if input output redirection is requested.
So for ex:
If the user writes: wc -l < document.txt
My shell will store the command wc-l in a string
and the file name document.txt in another string.
str1[] = "wc - l"
str2[] = "document.txt"
For output redirection it's the same
For ex:
If the user writes ls - l > document.txt
str1[] = "ls - l"
and
str2[] = "document.txt"
Now I want to know how do i tell the shell to do the input output redirection
What instruction should I write before execvp?
if I have str1[] and str2[].
Thanks.
Thanks.