LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2004, 03:17 AM   #1
iasion
LQ Newbie
 
Registered: Mar 2004
Posts: 12

Rep: Reputation: 0
execl on a script file


Hi guys

I hope someone can help me with this little problem. How do I run a script from within a c program? I can run binary executables (ls for example). However, when I try to run my script I get the following error:

Error initializing: Incompatible with this kernel

My script looks like this:

#!/bin/sh
touch keffo

If I run it from a shell it creates the file keffo. I have done the fork and uses execl in my program. This is the code snippet that does that:

pid_t pid;
switch (pid = fork()){
case -1:
printf("Fork failed\n");
break;
case 0: // Child process
execl("/home/iasion/test", "test", (char * )0);
printf("exec failed\n");
exit(1);
break;
default:
// printf("Created subprocess\n");
break;
}

The file has read, write and execute permissions for everyone and is owned på iasion.
 
Old 03-25-2004, 06:40 AM   #2
iasion
LQ Newbie
 
Registered: Mar 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Forget this thread. After some debugging i found out that the error was caused by something completely different.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
system() and execl anyone got any sample code please? twirl Programming 2 09-08-2005 02:01 AM
How to use execl, man is not helping grupoapunte Programming 2 05-29-2005 07:27 PM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
execl: couldn't exec `/bin/sh' Daredevil Linux - Newbie 2 04-12-2004 11:06 AM
Can I put execl command output into a file? CrazyDragon Programming 1 12-17-2003 04:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration