Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
Redirection (computing)
In computing, redirection is a form of interprocess communication, and is a function common to most command-line interpreters, including the various Unix shells that can redirect standard streams to user-specified locations. The concept of redirection is quite old, dating back to the earliest operating systems (OS).[citation needed] A discussion of the design goals for redirection can be found already in the 1971 description of the input-output subsystem of the Multics OS. However, prior to the introduction of UNIX OS with its "pipes", redirection in operating systems was hard or even impossible to do.
In Unix-like operating systems, programs do redirection with the dup2(2) system call, or its less-flexible but higher-level stdio analogues, freopen(3) and popen(3).
Redirection is usually implemented by placing certain characters between commands.
Typically, the syntax of these characters is as follows, using < to redirect input, and > to redirect output. command > file1 executes command, placing the output in file1, as opposed to displaying it at the terminal, which is the usual destination for standard output. This will clobber any existing data in file1.
Using command < file1 executes command, with file1 as the source of input, as opposed to the keyboard, which is the usual source for standard input.
command < infile > outfile combines the two capabilities: command reads from infile and writes to outfile
To append output to the end of the file, rather than clobbering it, the >> operator is used: command1 >> file1.
To read from a stream literal (an inline file, passed to the standard input), one can use a here document, using the << operator:
Hub AI
Redirection (computing) AI simulator
(@Redirection (computing)_simulator)
Redirection (computing)
In computing, redirection is a form of interprocess communication, and is a function common to most command-line interpreters, including the various Unix shells that can redirect standard streams to user-specified locations. The concept of redirection is quite old, dating back to the earliest operating systems (OS).[citation needed] A discussion of the design goals for redirection can be found already in the 1971 description of the input-output subsystem of the Multics OS. However, prior to the introduction of UNIX OS with its "pipes", redirection in operating systems was hard or even impossible to do.
In Unix-like operating systems, programs do redirection with the dup2(2) system call, or its less-flexible but higher-level stdio analogues, freopen(3) and popen(3).
Redirection is usually implemented by placing certain characters between commands.
Typically, the syntax of these characters is as follows, using < to redirect input, and > to redirect output. command > file1 executes command, placing the output in file1, as opposed to displaying it at the terminal, which is the usual destination for standard output. This will clobber any existing data in file1.
Using command < file1 executes command, with file1 as the source of input, as opposed to the keyboard, which is the usual source for standard input.
command < infile > outfile combines the two capabilities: command reads from infile and writes to outfile
To append output to the end of the file, rather than clobbering it, the >> operator is used: command1 >> file1.
To read from a stream literal (an inline file, passed to the standard input), one can use a here document, using the << operator: