मुझे लगता है कि आपके सवाल का कई व्याकरण में निहित झूलते किसी और अस्पष्टता के बारे में है, बाश में ऐसी कोई बात नहीं है। प्रत्येक if
को किसी ब्लॉक fi
द्वारा अवरुद्ध किया जाना चाहिए यदि ब्लॉक के अंत को चिह्नित किया गया हो।
इस तथ्य को देखते हुए (अन्य वाक्य रचनात्मक त्रुटियों के अलावा) आप देखेंगे कि आपका उदाहरण मान्य बैश स्क्रिप्ट नहीं है। कुछ त्रुटियों को ठीक करने का प्रयास करने से आपको
if condition
then
echo "do this stuff"
elif condition
then
echo "do this stuff"
elif condition
then
echo "do this stuff"
if condition
then
echo "this is nested inside"
# this else _without_ any ambiguity binds to the if directly above as there was
# no fi colosing the inner block
else
echo "this is nested inside"
# else
# echo "not nested"
# as given in your example is syntactically not correct !
# We have to close the last if block first as there's only one else allowed in any block.
fi
# now we can add your else ..
else
echo "not nested"
# ... which should be followed by another fi
fi
बिल्कुल कुछ ठीक हो सकता है! धन्यवाद –