0

I'm in the process of generating an automatic installation script. I want to test if the tool already is already installed in the system, I found this line :

  if [$? -eq 0] 

but I did not understand what it means... is it complete or not?

thank you in advance.

paltaa
  • 2,985
  • 13
  • 28
ZackAadj
  • 11
  • 3

1 Answers1

0

$? shows the exit code of the previous process, If everything is ok then the exit code is equals to 0, 1 for the processes having minor problems/warnings and 2 or more than 2 means fatal errors were caused and during termination of the process

so -eq here means equals

so basically this line of code is checking if the exit code of previous process was 0 or not

Deviprasad Sharma
  • 470
  • 1
  • 8
  • 19