![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to include RETURN KEY with Background process "&" in Shell Script | racbern | Shell Programming and Scripting | 1 | 03-11-2008 04:30 AM |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 12:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 10:52 PM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 01:15 AM |
| My "Bread and Butter" Process Keep Alive Perl Script.... | Neo | Tips and Tutorials | 0 | 01-08-2005 02:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
execv lauches a process using "/bin/sh -c"
Inside the C program, when execv(cPath, argv) is called, it launches new process image using "/bin/sh -c" option even if it is getting launched from C-shell. Is there a way to make execv to use "/bin/csh " or "/bin/sh"(without -c option)..
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You are confused. system() performs the shell driven execution. man execve (which is the core function for the C exec() functions) is what you need to read. exec will only execute the shell when the first line contains the bang #!$(shell here) token. Thus you can exec any shell script in any shell using the exec functions.
|
|
#3
|
|||
|
|||
|
Quote:
Quote:
Quote:
|
|
#4
|
|||
|
|||
|
For my case of execv(cPath, argv),
Current process image, argv[0] is "/finder/95s/ed/bin/or_run_report" and new process image, cPath is "/users/sch83995/test/sbin/or_run_report". Please look at the below output where current process image is not getting terminated..and new process image is launched. Reva% ps -ef | grep report shafi 26624 26078 0 11:42:37 pts/43 0:00 grep report shafi 26586 1 0 11:42:07 pts/43 0:00 /bin/csh -f /finder/95s/ed/sbin/reports_run_launcher SPIDER shafi 25413 24346 0 11:10:41 pts/32 0:00 vi or_run_report.csh shafi 26597 26589 0 11:42:18 pts/43 0:00 /bin/sh -c /finder/95s/ed/bin/or_run_report 'INSTALL/install@fnd9i' SPIDER /use shafi 26598 26597 0 11:42:18 pts/43 0:00 /bin/csh -f /users/sch83995/test/sbin/or_run_report SPIDER /users/sch83995/12 Reva% Reva% |
|
#5
|
|||
|
|||
|
Which shell is chosen to execute a script depends only on the format of the shebang line in your script. It has nothing to do with the shell that you are currently interacting with. If your script does not contain the shebang line and you want to pick the shell for your script's execution use the execl() system call.
|
|
#6
|
|||
|
|||
|
I used "/bin/ksh -c" instead "/bin/sh -c" .. It resolved my problem..I hope this will not affect ? I am using Korn-Shell to execute the binary executable(C-programme) ?
|
|||
| Google The UNIX and Linux Forums |