Redirection (Unix)

Redirection is a function common to most Unix shells which allow standard streams to be redirected to user-specified locations. Redirection is usually implemented by placing certain characters between commands. Typically, the syntax of these characters is as follows:
  command1 > file1   
execute 'command1', placing the output in file1
  command1 < file1  
execute 'command1', using 'file1' as the source of input (as opposed to the keyboard).
  command1 | command2    
execute 'command1', using its output as the input for 'command2' (commonly called 'piping', since the "|" character is known as a pipe.) In sh based shells, the first two actions can be further modified by placing a number (the file descriptor) immediately before the character; this will affect which streamvis used for the redirection. In csh based shells, the syntax instead appends a & to the redirect characters which achieves a simiar result. For example:
  command1 2> file1 
execute 'command1', directing the standard error stream to 'file1' (useful since standard error outputs always to the terminal and is unaffected by redirects unless so specified). The three tokens can be chained together to create complex commands; for example:
  ls | grep '.sh' | sort > shlist     
lists the contents of the current directory, where this output is filtered to only contain lines which contain '.sh', sort this resultant output alphabetically and place the final output in 'shlist'. This type of construct is used very commonly in Unix shell scripts.

 

<< PreviousWord BrowserNext >>
string quartet no. 11 (beethoven)
cocktail (movie)
der schwanendreher
international maritime signal flags
hocus pocus
joanna southcott
malika dhurn teeluck
marguerite de launay, baronne staal
m50 motorway (united kingdom)
maison de verre
harrold
the adventures of stoke mandeville, astronaut and gentleman
warping of space by gravity
movement for the liberation of so tom and prncipe
kitkat
the miami herald
bruce highway
loch long
fastnet race
wainuiomata
censorship in the united kingdom
river otter
bermuda rock skink
early history of ireland
no. 216 squadron raf
giudicati
hotepsekhemwy
urban areas of new zealand
qa'a
oldest town in britain
president of so tom and principe
sela (star trek)
oban (disambiguation)
alamein kopu
silver goal
entactogen
carrantuohill
sunrise problem
michael daley award
bette davis eyes
simon d. perry
haast
junkers ju 86
commissioner of police of the metropolis