I was wondering whether or not it is possible to time out an input/output redirection in Linux. Meaning that I would like to redirect certain input/output to a file just for a time span of 2s for instance. In a practical case, I am looking to cat the tty0 to a file only during 2s How can I achieve this?
Tag: pipe
BASH: Filter list of files by return value of another command
I have series of directories with (mostly) video files in them, say I create a variable (video_dir) with the directory names (based on other parameters) and use that with find to generate the basic list. I then filter based on another variable (video_type) for file types (because there is sometimes non-video files in the dirs) piping it through egrep. Then
Parent/Child and pipes in C, child-parent comunication
I have a parent program that sends a integer to a child, and the child program multiplies the number by two and gives back to the parent. In a main program I create a pipe and fork() and execl() the child, after a switch I pass the value through pip to child in child i can get the value, but
Running process that feeds on pipe STDOUT is untrackable until something is fed to pipe STDIN
I’m trying to implement named PIPE based inter-process communication between a running java program and console. Contents of java program (Test.java) are: Program was compiled using: A named pipe was created: Then program was ran as consumer of pipe STDOUT: Then, using console, I’m sending a ping to pipe STDIN: Which is captured by java program, outputting: Now the strange
How to log the live output of a running process
I want to run a game server inside my Ubuntu machine. I want to run it in the background and write the live output of that process inside a log file. I tried using nohup and running the game server using “&” at the end but I couldn’t make it work the way I wanted. Then I started reading about
mixing process substitution and pipes in zsh
Using ZSH, I am trying to wrap a sed command into a function, then use it, while mixing pipes with process substution. Let me explain with an example: As you can see, in those 2 out of those 3 usages work. The last one is the one that intrigues me here. (Note that all commands work with bash) Can you
Unable to exit while loop after reading information written to pipe
TLDR: You have to close the write end of all pipes in all children. The read will detect EOF only if no process has the write end still open. Credits to @Bodo As part of an assignment for an operating systems course, I’m trying to read lines from a file which is in the format of x operand y and
Apparent invocation of macro not resolved in sas filename pipe
I am using the following SAS code to find all files and their sizes under the directory &directory. Though the output data tmp is what I want, the code will give me warning. WARNING: Apparent invocation of macro S not resolved. I have tried adding an extra ‘%’ before ‘%’, i.e. but it doesn’t work. How can I get rid
How to avoid read() from hanging in the following situation?
I have some code that forks a third-party application and redirects its standard output to the parent process, roughly as follows (no error handling here for brevity): I have no code for the third-party application, it is a proprietary binary. When running the third-party application in a terminal with the same arguments as used in the code above, it eventually
read() hangs on zombie process
I have a while loop that reads data from a child process using blocking I/O by redirecting stdout of the child process to the parent process. Normally, as soon as the child process exits, a blocking read() in this case will return since the pipe that is read from is closed by the child process. Now I have a case