Im working on shell like software under Linux,
In my shell the main process print ">>" than the user enter the command.
The main process forking new process that will execute the command
And than new ">>" will be printed
To run the wanted command im using execl (I have to use this specific command)

The problem is in the printing of the next ">>", because im using different processes I cant control the time of the next ">>" prin

Example:
For ls command
Output:

>>ls
>>
Files….

Same command again (like i wish that will be printed evry time)
>>ls
Fils…
>>

(for the record, after execl command the process is terminated, no command will run after the execl)

Recommended Answers

All 4 Replies

Do you call wait() in the parent process?

Do you call wait() in the parent process?

no, how can I make shore that the father (main process) will start again exactly after the son (the new process that will run the command) And will not wait to long or to short (if the user run a command that required long cpu time)?

Is the wait() will make the father wait until his son is killed or will wait for a random time?

There is a nice utility called 'man'. Type 'man wait' at a command prompt and read the documentation.

And yes, wait is the only way to inform parent that child terminated. Besides, omitting wait() will lead to some nasty surprises.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.