Sponsored Content
Top Forums Programming fork&pipe "interpretting" shell - problem Post 302306617 by IdleProc on Monday 13th of April 2009 10:20:46 AM
Old 04-13-2009
fork&pipe "interpretting" shell - problem

hello everybode.Got some sort of "problems" with this stuff;
well this is a program
Code:
int main()
{
    int Pipe[2];
    int origStdin, origStdout;
    int childPID;
    origStdin = dup(0);
    origStdout = dup(1);
    pipe(Pipe);
    if( (childPID = fork()) < 0 )
    {
        perror( "Fork Error" );
        exit(-1);
    }
    if( !childPID )
    {
        dup2( Pipe[0], 0 );
        dup2( origStdout, 1 );
        close( origStdout );
        close( origStdin );
        close( Pipe[0] );
        close( Pipe[1] );
        execlp( "/bin/sort", "sort", NULL );
        perror("Execl error");
        exit(-1);
    }
    dup2( Pipe[1], 1 );
    close( Pipe[0] );
    close( Pipe[1] );
    close( origStdout );
    close( origStdin );
    execlp( "/bin/cat", "cat","a.txt","b.txt", NULL );
    perror( "EXEC Error");
    return 0;
}

problem is that :after the work hav done it[program] (unfortunatly top utility do not show nor cat nor sort) stuck(freezes or smth) )just got it whats that!
it tty or who? do not show its bash-blablabla-$ ? why? and how to make to show this string?
Smilie

Last edited by jim mcnamara; 04-13-2009 at 01:26 PM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

korn shell "loops & arrays"

Hi, I am trying to write a script which will loop until a certain action has been performed. I have two files i would like to compares. For example: file1 has a list of user ids (about 900) from the company's e-mail server. file2 has a list of user ids (about 50 or so) from... (7 Replies)
Discussion started by: muzica
7 Replies

2. UNIX for Dummies Questions & Answers

Encoding Problem while using "|" (PIPE) as delimiter from Mainframe to Unix

We are facing a problem with PIPE (|) as a delimiter in one of our FTP flat files. We are constructing a Flat file in IBM-AIX and this contains various strings delimted by PIPE Symbol and then FTPing this to a Mainframe System The Mainframe program simply recieves this and FTPs the same... (1 Reply)
Discussion started by: seshendra
1 Replies

3. Shell Programming and Scripting

shell script & sqlplus "plzz help"

hi friends, i m tryin to load data from one set of table to other i have sql procedure al ready for it..! i m going to load the procedure only if data in one of my table for example table "landing " have 10 records each attribute of this table is file_name status date ... (2 Replies)
Discussion started by: kulbir
2 Replies

4. Shell Programming and Scripting

How to include RETURN KEY with Background process "&" in Shell Script

Hello All, I am a newbie in Shell script programming, and maybe you can help me with my query. I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script. The mntServer.ksh script contains: #!/bin/ksh... (1 Reply)
Discussion started by: racbern
1 Replies

5. UNIX for Dummies Questions & Answers

Problem using unix command with "&"

Hello, I've tried running several commands but am not getting the results I expect. Just to give you some background: 1) I'm running windows vista 2) I'm using Putty and have enabled X11 forwarding 3) I have also installed xming 4) I am using a free unix shell acount from devio.us 5) The... (5 Replies)
Discussion started by: Tazor44
5 Replies

6. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

7. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

8. Web Development

How would I mod_rewrite "/~a1Pha" and "/=a1Pha" to "/paste/a1Pha.htm"? (internally & externally)

Basically I want to shorten URLs on my html pasting site (pasteht.ml), by using "/~a1Pha" instead of "/paste/a1Pha". The ID is 5 numbers and letters, both cases. For example: /~idnum serves /paste/idnum.htm /=idnum serves /paste/idnum.htm /paste/idnum redirects to /~idnum (to update any old... (0 Replies)
Discussion started by: phillips1012
0 Replies

9. AIX

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (2 Replies)
Discussion started by: thisissouvik
2 Replies

10. Shell Programming and Scripting

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (14 Replies)
Discussion started by: thisissouvik
14 Replies
Child::Link::IPC::Pipe::Proc(3pm)			User Contributed Perl Documentation			 Child::Link::IPC::Pipe::Proc(3pm)

NAME
Child::Link::IPC::Pipe::Proc - Proc object used by the pipe plugin. SEE ALSO
This class inherits from: Child::Link::Proc Child::Link::IPC Child::Link::IPC::Pipe HISTORY
Most of this was part of Parrallel::Runner intended for use in the Fennec project. Fennec is being broken into multiple parts, this is one such part. FENNEC PROJECT
This module is part of the Fennec project. See Fennec for more details. Fennec is a project to develop an extendable and powerful testing framework. Together the tools that make up the Fennec framework provide a potent testing environment. The tools provided by Fennec are also useful on their own. Sometimes a tool created for Fennec is useful outside the greator framework. Such tools are turned into their own projects. This is one such project. Fennec - The core framework The primary Fennec project that ties them all together. AUTHORS
Chad Granum exodist7@gmail.com COPYRIGHT
Copyright (C) 2010 Chad Granum Child is free software; Standard perl licence. Child is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. perl v5.10.1 2011-03-07 Child::Link::IPC::Pipe::Proc(3pm)
All times are GMT -4. The time now is 06:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy