pipe

line of bash code from .configure file

I need to understand the following line of code: BIN_DIR=`grep BIN_DIR= $SMLCM | head -1` where $SMLCH contains a path This is what I understood so far: grep will produce some string(s), possible paths. What does grep do with BIN_DIR=? the pathes are passed to head and all files within the paths will be used to extract their first ...

Win32 Sockets vs. Named Pipes

Is it possible to use sockets on win32 and and not have the firewall possibly block the port you are using? Something like with unix wwere you have IF_UNIX instead of IF_INET ( named pipes instead of sockets ). I dont want to use named pipes on win32 since they are just so unreliable. ...

pipe, standard input and command line arguments in bash

Consider: command1 | command2 Is the output of command1 used as standard input of command2 or as command line arguments to command2? For example, cat test.sh | grep "hehe" What is its equivalent form without using pipe? I tried grep "hehe" $(cat test.sh) and it seems not correct. ...

With bash, how can I pipe standard error into another process?

It's well known how to pipe the standard ouput of a process into another processes standard input: proc1 | proc2 But what if I want to send the standard error of proc1 to proc2 and leave the standard output going to its current location? You would think bash would have a command along the lines of: proc1 2| proc2 But, alas, no. Is ...

Problem with O_NONBLOCK Pipe

Hi, I'm trying to send and receive using pipes: send.cpp struct { long a; long b; }T; cout << "1" << endl; if ( access ( FIFO_NAME, F_OK ) == -1 ) { res = mkfifo ( FIFO_NAME, 0755 ); if ( res != 0 ) cout << " Can't make fifo" << endl; } cout << "2" << endl; pipe_fd = open ( FIFO_NAME, O_WRONLY); cout << "...

Switch from file contents to STDIN in piped command? (Linux Shell)

I have a program (that I did not write) which is not designed to read in commands from a file. Entering commands on STDIN is pretty tedious, so I'd like to be able to automate it by writing the commands in a file for re-use. Trouble is, if the program hits EOF, it loops infinitely trying to read in the next command dropping an endless to...

perl hangs on exit (after closing a filehandle)

I've got a function that does (in short): my $file = IO::File->new("| some_command >> /dev/null 2>&1") or die "cannot open some_command for writing: $!\n"; ... undef $file; Right now I'm not even writing anything to $file. Currently there are no other operations on $file at all. When I run the program, it doesn't exit properly. I...

How can I use Linux's splice() function to copy a file to another file?

Hello--here's another question about splice(). I'm hoping to use it to copy files, and am trying to use two splice calls joined by a pipe like the example on splice's Wikipedia page. I wrote a simple test case which only tries to read the first 32K bytes from one file and write them to another: #define _GNU_SOURCE #include <fcntl.h> #in...

Is there any difference between socketpair and pair of unnamed pipes?

I would like to know not only user-side differences, but differences / common parts in Linux kernel implementation as well. ...

Why does write() to pipe exit program when pipe writes to stdout?

I have a server application that writes to a popen("myCommand", "w") file descriptor in a separate thread and if the command passed to popen() results in any output to stdout or stderr, the my application exits. However, this is only an issue when my server application was invoked via inetd, if I used ssh to launch the server, it does n...

Connecting Two Bash Commands

I have Ubuntu Linux. I found one command will let me download unread message subjects from Gmail: curl -u USERNAME:PASSWORD --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" ...and then another comma...

how to display data comming from pipe on GUI form in C #

I have made a small server and client application connected via named pipe. I am able to communicate between them in console application. Now i want that data to be displayed in text box on form. I am not able to display, once i assign the data it gets assigned but text box is not showing the new up dated value. Can any one help me to ...

How to get the PID of a process that is piped to another process in Bash?

Hi, I am trying to implement a simple log server in Bash. It should take a file as a parameter and serve it on a port with netcat. ( tail -f $1 & ) | nc -l -p 9977 But the problem is that when the netcat terminates, tail is left behind running. (Clarification: If I don't fork the tail process it will continue to run forever even the ...

fork() and pipe()

I need help with this sample application. When I run it, it gets stuck after the child process prints "Child sending!". #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #define INPUT 0 #define OUTPUT 1 int main() { int fd1[2]; int fd2[2]; int pid; if (pipe(fd1) < 0) ...

Forks and Pipes in C UNIX

I'm not sure if I am even barking up the right tree here... but here goes. I'm trying to pass data from my parent process to all children. It's a simple server program that basically will keep a list of connected clients and then send the routing table of connected clients to every client. This is eventually going to include a struct of...

linux shell: How to read command argument from a file?

I have process id in a file "pid" I'd like to kill it. Something like: kill -9 <read pid from file> I tried: kill -9 `more pid` but it does not work. I also tried xargs but can't get my head around it. ...

Named pipe C# using .NET 3.5 features like NamedPipeClientStream

Are named pipes in Windows (and other OS as well process wide)? I have this weird scenario: I wrote a program lets say "Controller.exe" which spawns a bunch of "Workers.exe", then Controller.exe creates a named pipe called "Pipe0" ... through "PipeN". Then Workers.exe (who are started with a command line arg as the name of the pipe) g...

Non-blocking pipe using popen?

I'd like to open a pipe using popen() and have non-blocking 'read' access to it. How can I achieve this? (The examples I found were all blocking/synchronous) ...

Replacement for Vern Buerg's list.com in 64 bit Windows 7

I would like to find a replacement for list.com, specifically the ability to accept piped input. For example: p4 sync -n | list which accepts the output of the perforce command and displays the results in the viewer/editor for manipulation or saving. I know that I would send the output to a file and then open the file in the viewer/ed...

Using NSTask with an NSPipe and a Perl script that spawns another process

I am running a Perl script within an NSTask object with it's output going into an NSPipe. I am using notifications to receive it's output periodically and update the GUI. The Perl script actually spawns other processes whose output doesn't seem to go into this pipe, but does appear in the debugger console and I can see them running ther...