1.

A shell script stopped running when we change its name. Why?(a) location of the file changed(b) we can’t change the name of the script(c) $0 was used in the script(d) many possible reasonsI have been asked this question in an internship interview.Query is from Shell Programming using Various Commands in division Essential Shell Programming of Unix

Answer»

The correct answer is (c) $0 was USED in the script

For EXPLANATION I WOULD say: A shell script will stop running when we change its name if we’d used the POSITIONAL PARAMETER $0 in it as $0 contains the name of the script file.



Discussion

No Comment Found

Related InterviewSolutions