The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+18 votes

I/O redirection

  1. implies changing the name of a file

  2. can be employed to use an existing file as input file for a program

  3. implies connecting $2$ programs through a pipe

  4. None of the above

asked in Operating System by Veteran (59.8k points)
edited by | 2.4k views

Redirection simply means capturing output from a file, command, program, script, or even code block within a script and sending it as input to another file, command, program, or script.



in layman terms, Redirection is changing the standard input/output devices while executing a command, like for standard input we have keyboard and for standard output we have screen or terminal.

So B suits the best as it means to use an existing input file for taking input , instead of using standard keyboard device. So clearly we have redirected the input from keyboard to file.

1 Answer

+26 votes
Best answer

Answer: (B)

Typically, the syntax of these characters is as follows, using < to redirect input, and > to redirect output.

command1 > file1

executes command1, 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.


command1 < file1

executes command1, with file1 as the source of input, as opposed to the keyboard, which is the usual source for standard input.

command1 < infile > outfile

combines the two capabilities: command1 reads from infile and writes to outfile.

answered by Boss (34k points)
edited by
but that's not what is asked in question rt?
The questions asks for 'programs' in place of 'commands'. Can a conclusion be drawn from here: ?
I would say 'b' is the answer. 'C' is not correct as IO redirection doesn't imply that. IO redirection can be used for connection is fine.
Yes, got it! Corrected.

 redirection is a technique for moving visitors to a different Web page than the one they request, usually because the page requested is unavailable isn't it ?
so it is something that connects 2 things (program) so by this assumption can we make "c"  as answer ???


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,126 questions
53,251 answers
70,502 users