1.

Which of the following is used for storing the number of positional parameters?(a) $n(b) $#(c) $*(d) $2This question was addressed to me during an online exam.The origin of the question is Shell Programming using read Command and Command Line Arguments topic in division Essential Shell Programming of Unix

Answer»

Correct choice is (B) $#

To explain: $# is used for storing the NUMBER of arguments specified. It lets us design scripts that CHECK whether the right number of arguments have been ENTERED. For example, the FOLLOWING script shows the use of positional parameters:



Discussion

No Comment Found

Related InterviewSolutions