Hi All,
Doing practice and creating a zombie process getting the below error.
[root@seRver3 tmp]# cat zomibe.c
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
pid_t child_pid;
child_pid = fork ();
if (child_pid > 0) {
sleep (60);
}
else {
exit (0);
}
return 0;
}
[root@seRver3 tmp]# ls -l zomibe.c
-rwxr-xr-x. 1 root root 205 Jun 19 23:46 zomibe.c
[root@seRver3 tmp]# source zomibe.c
-bash: zomibe.c: line 5: syntax error near unexpected token `('
-bash: zomibe.c: line 5: `int main ()'
[root@seRver3 tmp]#
Please correct me or share the correct steps to practice.
Regards, Saahil
Thank you!!
I skipped the step to compile the c program. Now it is working fine.
1. created zombie.c file.
2. Installed the GCC package.
3. Compiled the .c file.
4. On top command, showing zombie process.
5. Unable to kill the zombie process.
Regards, Saahil
100% the solution.
Sourcing in the Linux shells, only works for files written in the language of that shell.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.