LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   execl problem (https://www.linuxquestions.org/questions/linux-newbie-8/execl-problem-637625/)

jodie 04-24-2008 04:34 PM

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

stevexyz 04-27-2008 02:36 PM

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


All times are GMT -5. The time now is 02:29 PM.