got a small problem here. im trying to pipe eg: 'ls | more'.
i have created a command line parser which separates ls and more into two commands. i have also created a struct, each struct has a command name, number of arguments, redirect_in, redirect_out, pipe_in, etc etc.... eg:
struct com[0].com_name would be : ls
struct com[0].pipe_to = 1 ( 1 means pipe to command 1 )
struct com[1].com_name would be : more
now when i try and pipe the above ( ls | more ), only the 'ls' command is executed and more is not. the execute method is called from the main class eg :
this is my execute method:
what i think needs to be done is when the 'ls' command is executed, it should go back to the main program, increase 'k++' (increase command by 1) and go back to the execute method without forking again and execute the command pathname of command which was just increased-> but it doesnt seem to be doing that.
I already manage to get the output that i want.. but wat if removing all the pipes and convert it 1 liner with less pipes. My command below can get the ouput that i want. i just want to remove the pipes or less pipes.
#cat file1
us-west-2a running i-3397a421... (2 Replies)
Hey guys!
First of all english is not my main language so sorry for any english mistakes.
Im from Portugal!
1. The problem statement, all variables and given/known data:
Im having a problema creating and array of structs for a work i need to do. (xLib)
2. Relevant commands, code,... (1 Reply)
Hey guys!
First of all english is not my main language so sorry for any english mistakes.
Second im a total beginner in programming, still i have a school work to do and i found a problem. Probably something easy to solve but it's driving me crazy.
So i created a struct, that holds 4 ints:
... (1 Reply)
this is my code to try and prinnt out a deck of cards. the print function worked when used inside main without being a function but now i cant get it to work as a function probably since i dont know how to pass a struct array in c. I gave it a shot but i keep getting an assortment of errors. The... (0 Replies)
ls --color=always -laX | awk '{print $1, $3, $4, $2, $8}'
|sort -k 1,1 -k 9,9r
they work separately... but i don't know how to combine this to work.
thx! (1 Reply)
Hello all, I am trying to learn more about programming Unix pipes in C.
I have created a pipe that does od -bc < myfile | head
Now, I am trying to create od -bc < myfile | head | wc
Here is my code, and I know I might be off, thats why I am here so I can get some clarification.
#include... (1 Reply)
This is something I've given a lot of thought to and come up with no answer.
Say you have a data stream passing from a file, through process A, into process B. Process A only modifies a few bytes of the stream, then prints the rest of the stream unmodified. Is there any way to stream the file... (4 Replies)
A broken pipe means that you are writing onto a pipe that has been closed by the other end.
i have unix batch which forks some process
and these processes are communicating each other via pipes.
but sometimes i got too many broken pipe error.
how can i search for the cause of these errors,... (1 Reply)
Hi,
Can the cd command be invoked using pipes???
My actual question is slightly different. I am trying to run an executable from different folders and the path of these folders are obtained dynamically from the front end. Is there a way in which i can actually run the executable... (2 Replies)