Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
817 views
in Programming by (120k points)
closed by
We can redirect the error message to file named newfile using __________ command.

(a) cat  foo  errorfile

(b) cat  foo >errorfile

(c) cat errorfile>foo

(d) cat foo 2>errorfile

1 Answer

0 votes
by (120k points)
selected by
 
Best answer
Right answer is (d) cat foo 2>errorfile

The best explanation: Redirecting standard error requires the 2> symbol. Suppose if foo doesn’t exist then an error message ‘cannot open foo’ will be generated but we can send this message to another file. But here > and >> cannot be used. We have to use 2> symbol as the file descriptor number 2 represents the standard error stream.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...