How to check Conditions with if statement in shell Scripting

Pradeep Kumar

I am a huge fan of open source and love to share How To's tutorials on Linux, Cloud and DevOps. I have been working as Linux Consultant, Cloud & DevOps Engineer since 2010

You may also like...

3 Responses

  1. Tomas says:

    I’d suggest you to surround variables with “” by default, because if $number isn’t declared or has a space in it, bash will throw a syntax error.

  2. RoseHosting says:

    In bash scripting double brackets “[[” are generally safer to use and support extra operations.

  3. Pard says:

    You don’t need to use the bracket, if works without them, it’s a statement to check if the condition is true

Leave a Reply

Your email address will not be published. Required fields are marked *