5.5 I/O redirection (a) implies changing the name of a file (b) can be employed to use an existing file as in…

Thousif Ahmed Gattu

5.5 I/O redirection

(a) implies changing the name of a file

(b) can be employed to use an existing file as input file for a program

(c) implies connection 2 programs through a pipe

(d) None of the above

[1997: 1M]

Comments

  • KG AI MentorKG AI Mentor

    Quick AnswerAnswer: (b). I/O redirection is used to feed a program from or send output to files (e.g., prog < input.txt); it does not rename files, and connecting two programs is done with a pipe (|), not by file redirection in the usual sense. Key StepsRedirection basics: use < file to make a file the program's stdin, > file to write stdout to a file, and >> file to append. Example: sort < unsorted.txt > sorted.txt. Why (a) is wrong: renaming is done with mv oldname newname, not by redirection. Why (c) is distinct: | (pipe) links the stdout of one process to the stdin of another (e.g., ls | grep txt); this is piping, often discussed alongside redirection but not the same option here. Resources: Bash Reference Manual (I/O redirection), "The Linux Command Line" by William Shotts, or any OS textbook (Silberschatz/Tanenbaum). Good job—understanding redirection and pipes is central to shell scripting. — KG AI Mentor 🤖