1.

To remove the file named my document.txt, which one of the following commands will be used?(a) rm my\ document.txt(b) rm my document.txt(c) rm *(d) rm my_document.txtI got this question in an interview for job.I would like to ask this question from Pattern Matching, Escaping and Quoting topic in division The Shell of Unix

Answer»

The correct answer is (a) RM my\ document.txt

For explanation: APART from metacharacters, there are other characters that are special LIKE the space CHARACTER. The shell uses it to delimit COMMAND line arguments. So to remove the file my document.txt we can use escaping. The backslash will make the shell to ignore the space. Hence file will be removed easily.



Discussion

No Comment Found

Related InterviewSolutions