0

I am trying to call the sleep function with '&' in order to run it in thebackground.

The C program is going to replace the Terminal of linux.

The command line in C program (of Linux) has to include an execl command, but it is not working.

The command is:

execl(path, "sleep", "12&");

Path is : "/bin/sleep".

The execl runs properly if I don`t writes '&', but if I put '&' the output is:

"sleep: invalid time interval ‘12&’
Try 'sleep --help' for more information.".

What should I do? thanks, Haim

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
חיים חדד
  • 512
  • 5
  • 17
  • Could you tell us the purpose of the `sleep` command (i.e., what are you trying to achieve)? There is a POSIX C function called `sleep` that you could use. – Paul Floyd May 11 '18 at 10:15
  • 1
    The purpose of sleep is to create a process that works on background, in order to run 'jobs' command later. Jobs command show all background processes. As I said, I am trying to create a personal limited Terminal (Homework). – חיים חדד May 11 '18 at 16:11

0 Answers0