08-29-2001
shell command from C
Check out then man pages for...
system(3) and popen(3)
Typically you would "exec" after a fork()
call. While execvp can work, you may have
some issue with the conversion of the
"input" into an appropriate form for the
call.
int execvp( const char *file, char *const argv[]);
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
suppose have different files
1.1
2.2
3.3
4.4
5.5
All the files have to run under the same command say
tr -d '\n'
so how to run all the files under the same command by using shell script (3 Replies)
Discussion started by: cdfd123
3 Replies
2. Shell Programming and Scripting
Hello ,
I want to run some shell scripts in my perl script. I need to read the script's name from a file ( this file includes the name of all the scripts) and run the script one by one.. Please let me know how to go ..
Thanks in advance,
Radha (5 Replies)
Discussion started by: s123.radha
5 Replies
3. Shell Programming and Scripting
Hi
I am using a command "script" to capture the output of a command
my script is
#/bin/sh
script filename.txt
./execute_some_script.sh
exit
exit
Now my problem is that when my script run "script filename.txt" its fork a new shell and after the no other command execute
The remaining... (2 Replies)
Discussion started by: sushantnirwan
2 Replies
4. Shell Programming and Scripting
Hi there,
Imagine we have to run a command in python shell from a perl script.
1 #!/usr/bin/perl
2 use strict;
3 my @con;
4 @con = `python`;
5 #?????print `print 'salaam'`;????
What's suitable situation for fifth line?
Thanks in advance. (4 Replies)
Discussion started by: Zaxon
4 Replies
5. Shell Programming and Scripting
I need to write a c program that uses the fork and excel system calls to run the shell script mode invoked like this: "./mode 644 ls -l" (that is the argumetns will always be 644 ls -l)
here's the mode script:
#!/bin/sh
octal="$1"
shift
find . -maxdepth 1 -perm $octal -exec $@ {} \;
... (3 Replies)
Discussion started by: computethis
3 Replies
6. Shell Programming and Scripting
Hello
I am trying to run a python program using shell script, which takes a single argument from a file.
This file has one entry per line :
1aaa
2bbb
3ccc
4ddd
5eee
...
...
...
My shell script runs the program, only for the last entry :
#!/bin/sh
IFS=$'\n'
for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies
7. Shell Programming and Scripting
Hey guys,
I have some task from my office to lock user on the specified directory after the user logged on using ssh. And then run prompt program to fill the required information. Yeah, just like an ATM system.
My question:
How could I do those?? AFAIK I have to edit the ~./bashrc. But the... (1 Reply)
Discussion started by: franzramadhan
1 Replies
8. UNIX Desktop Questions & Answers
Can someone point me to the right command to to run another shell on top of your default shell?
Thanks
PS If admin sees this It is not home work. I am old man who wants to learn unix in my spare time. I CURRENTLY DO NOT GO SCHOOL, COLLEGE OR UNIVERSITY. (2 Replies)
Discussion started by: Bill Thompson
2 Replies
9. Shell Programming and Scripting
Hi all,
I have the following Perl script which is intended to run a Shell script and generate some logging for the purposes of tracking weather or not the script ran.
I get an error, of course, since I don't know what I'm doing really.
Here is the code:
#!/opt/perl/bin/perl -w
... (14 Replies)
Discussion started by: zixzix01
14 Replies
10. Shell Programming and Scripting
HI,
I am trying to implement a simple shell script program that does not make use of ls or find commands as they are quite expensive on very large sets of files. So, I am trying to generate the file list myself. What I am trying to do is this:
1. Generate a file name using shell script, for... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies
LEARN ABOUT DEBIAN
iv_popen_request_init
iv_popen(3) ivykis programmer's manual iv_popen(3)
NAME
IV_POPEN_REQUEST_INIT, iv_popen_request_submit, iv_popen_request_close - popen(3) for ivykis applications
SYNOPSIS
#include <iv_popen.h>
struct iv_popen_request {
char *file;
char **argv;
char *type;
};
void IV_POPEN_REQUEST_INIT(struct iv_popen_request *this);
int iv_popen_request_submit(struct iv_popen_request *this);
void iv_popen_request_close(struct iv_popen_request *this);
DESCRIPTION
iv_popen provides ivykis(3) applications with an asynchronous version of popen(3) that is integrated with the ivykis event loop.
After initialising a struct iv_popen_request object using IV_POPEN_REQUEST_INIT and assigning its ->file and ->argv and ->type members, one
can call iv_popen_request_submit on it to fork off a child process which will call execvp(2) on ->file and ->argv, while in the parent
process returning a file descriptor that is connected to the child's standard input (if ->type equals "w") or standard output (if ->type
equals "r").
When the application is done with the child process, it should call iv_popen_request_close, and close the file descriptor returned by
iv_popen_request_submit (this is not done automatically).
iv_popen will continue to monitor the child's process state while it is running, by registering an iv_wait(3) interest for its process ID.
If the child process has not yet terminated when iv_popen_request_close is called, iv_popen will attempt to terminate the child process in
the background by sending it a series of SIGTERM and SIGKILL signals.
iv_popen_request_close must be called from the same thread that iv_popen_request_submit was called from on this object.
SEE ALSO
ivykis(3), iv_wait(3), execvp(2), popen(3)
ivykis 2010-09-04 iv_popen(3)