I have just started learning the fundamentals of Unix and wondering why there are so many shells in a unix like system .
Hi. I'm having trouble writing a wrapper script for the command line text editor gnu ed.
I want to be able to run the following algorithm on ed:
1. Display, on stdout, a command which I intend to feed into ed (before I actually feed it to ed).
2. Actually feed the command into ed's stdin.
3.
With unshare or lxc-execute I can create environments with separate network/mount/whatever namespaces. But starting programs there from outside is not really straightforward. Usually network and sshd is used, I also use UNIX socket with socat executing shell to start new processes on it.
Is there already a program that allows to starting applications inside unshares easily?
I've never really thought about how the shell actually executes piped commands. I've always been told that the "stdout of one program gets piped into the stdin of another," as a way of thinking about pipes. So naturally, I thought that in the case of say, A | B, A would run first, then B gets the stdout of A, and uses the stdout of A as its input.
I am trying to understand how to use the stdout as the stdin of another command. To test it, I am trying to use the following command to delete all directories from the current folder.
ls -d -- */ | rm -rf $1
I would expect the result of ls -d -- */ to be piped into the input of the rm, but it does not work. Ideas?
I want to redirect stdin/stdout to some file. The program is being written for Unix OS but I think using standart C/C++ library instead of OS functions is good. I know how I can do that using OS functions dup2() and open() but I read some ways to do that using reopen() on stdin or stdout. Will reopening standart variables do what I want? Will it replace files opened at 0 and 1 file descriptors?
As a zsh/process substitution noob, I expected cat <(cat) and cat | cat to do the same thing: copy lines from stdin to stdout.
Is there a way in Windows 7 cmd shell to redirect the stderr to stdout while keeping the stderr stream intact?
For example, I have a program that outputs to stderr and stdout the following message
TO STDOUT
TO STDERR
I want to have two files stderr.txt and stdout.txt with the following content
stderr.txt
TO STDERR
stdout.txt
TO STDOUT
TO STDERR
Is this possible?
My program is invoked by another process, and communicates with it via stdin and stdout. I want to interact with my program via a command line interface, but obviously the usual method of just running it in a terminal doesn't work. I'm looking for the simplest possible way of achieving this.
My program is currently written in Lua, but might become C or something else.