LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-24-2008, 05:34 PM   #1
jodie
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/dump.sh" , "/opt/myDB", (char*)0) < 0 )
.......................
I assume the first argument($1) is /opt/myDB so my /opt/dump.sh has the following command:
#!/bin/bash
dbdir=/opt
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.
JP
 
Old 04-27-2008, 03:36 PM   #2
stevexyz
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:
Quote:
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.

Code:
if ( execl( "/opt/dump.sh", "/opt/dump.sh", /opt/myDB", (char*)0) < 0 )
Cheers, Steve
 
  


Reply


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


All times are GMT -5. The time now is 04:17 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration