Call a UNIX shell with parameters from C


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Call a UNIX shell with parameters from C
# 1  
Old 03-14-2007
Call a UNIX shell with parameters from C

Hello...I hava quite a problem, couldn't find a solution anywhere Smilie. I have a C program, and from that C program I have to call a shell script. This is not difficult, I can do it using the "system" command from C. But the ugly part is how can I send as parameters some variables? For example...i have a char *s, which I read from keyboard, and I want to send this "char *s" to the shell....How? I found some commands like execl, execve, but they aren't working properly(or perhaps I dunno how to correctly use them). Any suggestions are most welcome.


Cheers!
# 2  
Old 03-14-2007
You can still use system, just assemble a command line and pass it to system. I just looked through our C forum and I quickly find several examples of this and several examples of using the exec family. Use the search function.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help on case to call recursively in UNIX Shell Script

Hi, I am New to Unix Shell Scripting basically, i need some help in achieving a case statement in Shell script to call recursively That is if case having like 1 2 3 4 options , if user inputs 1 and gets executed case should ask for options again but user should not input the same input value 1,... (7 Replies)
Discussion started by: karthikram
7 Replies

2. Shell Programming and Scripting

call another shell script and pass parameters to that shell script

Hi, I basically have 2 shell scripts. One is a shell script will get the variable value from the user. The variable is nothing but the IP of the remote system. Another shell script is a script that does the job of connecting to the remote system using ssh. This uses a expect utility in turn. ... (2 Replies)
Discussion started by: sunrexstar
2 Replies

3. Shell Programming and Scripting

Parameters + arrays in unix shell

Say I have ./param HEY What would I do if I wanted to store each character into an array? Example. ARRAY1="H" ARRAY1="E" ARRAY1="Y" thank you! (5 Replies)
Discussion started by: puttster
5 Replies

4. Shell Programming and Scripting

call function with different parameters position

Hi I would like to call function in my script couple of times. But each time with different parameters position. In line 57 I don't know how to call it without typing $1 and $ parameters ? #!/bin/ksh 2 3 4 function First 5 { 6 7 # $1 - name 8 ... (2 Replies)
Discussion started by: presul
2 Replies

5. Shell Programming and Scripting

how to call oracle stored procedure from unix shell

Hi i want to call a oracle stored procedure from unix (using bash shell). consider this is my oracle stored procedure with parameter create procedure testproc(name IN varchar, age IN Number, id OUT Number ) AS begin id=1; dbms_output.put.line('successfull validation') end;... (6 Replies)
Discussion started by: barani75
6 Replies

6. Shell Programming and Scripting

Unix Shell Script to loop over Directory and send Filesname as parameters

Hi there I'm new to UNIX scripting; I’m stuck with the following I have an Oracle SQL script that takes three parameters 1- File Name 2- File Path 3- File creation date Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need... (3 Replies)
Discussion started by: windjashi
3 Replies

7. Shell Programming and Scripting

call shell script with named parameters

Could someone help me to call a shell script with named parameters. I mean Callscript .sh -c someconfigfile.txt or callscript.sh -config someconfigfile.txt inside the script how can I retrieve someconfigfile.txt using the parametername -c or -config. Thanks. (2 Replies)
Discussion started by: rvijay80
2 Replies

8. Programming

How to call the C Programme in UNIX shell scripting...?

Hi All, How to call the C programme in UNIX shell scripting? please send me some sample script for the above scenario. Regards, MPS:b: (1 Reply)
Discussion started by: psiva_arul
1 Replies

9. Shell Programming and Scripting

Making a SOAP call from within unix shell scripts

Hi guys, Is it possible to make SOAP calls from within Unix shell scripts? I need to access a web service from within UNIX in order to lookup something while I am doing some parsing on a file. Regards, Laud (2 Replies)
Discussion started by: Laud12345
2 Replies
Login or Register to Ask a Question