Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-24-2008, 05:34 PM   #1
LQ Newbie
Registered: Sep 2007
Posts: 10

Rep: Reputation: 0
execl problem

Hi All,
I have the following statement to execute the shell script command
if ( execl( "/opt/" , "/opt/myDB", (char*)0) < 0 )
I assume the first argument($1) is /opt/myDB so my /opt/ has the following command:
cd $dbdir
sqlite3 $1 < dump_data.sql

$1 in this case is wrong. So how to pass /opt/myDB to my shell script
Thank in advance for your help.
Old 04-27-2008, 03:36 PM   #2
LQ Newbie
Registered: Apr 2008
Location: Hampshire, UK
Distribution: None
Posts: 27

Rep: Reputation: 16
Hi Jodie,

Have a look at the man page again:
The first argument, by convention, should point to the filename associated with the file being executed.
So just insert the file name a second time.

if ( execl( "/opt/", "/opt/", /opt/myDB", (char*)0) < 0 )
Cheers, Steve


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
execl and sprintf not working together mohammednv Linux - Kernel 2 01-27-2008 05:04 PM
execl question kev000 Programming 3 05-09-2007 09:17 AM
Help using popen and execl cdog Linux - Software 3 02-28-2007 07:44 PM
fork() + execl() confusion flare Programming 6 01-06-2007 07:21 PM
How to get the execl() output? estratos Programming 4 06-07-2006 06:18 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 PM.

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