I'll read this carefully and figure it out...I was
a BASIC and C++
man...shouldn't be too hard.
There is always a lot to learn...
But in shell scripting, the following two do the same thing:
if command
then
and:
command
if [ $? -eq 0 ]
then
Similarly:
if ! command
then
is the same as:
command
if [ $? -ne 0 ]
then
It reads easier (once you know) and it avoids the situation where someone
inadvertently puts something between the command and the 'if' that resets the $?
e.g. some attempt at debugging like 'echo $?'.
Rob