Question: I am not sure about this comparison i am doing:

```
   if [ "$exit_status" -eq 0 ];then
   #some statements
   fi

```

is this correct way of comparing numbers or quotes make the variable `exit_status` a string
to be compared with 0.I don't know if this could fail in some scenario.

Answer: 
`[ "$exit_status" -eq 0 ]` is correct if $exit\_status only contains digits, and you could just as well remove the quotes (as long as IFS doesn't contain digits).

If x is empty or unset, `[ "$x" -eq 6 ]` results in an error but `[[ "$x" -eq 6 ]]` doesn't:

```
$ x=; [ "$x" -eq 6 ]
-bash: [: : integer expression expected
$ unset x; [ "$x" -eq 6 ]
-bash: [: : integer expression expected
$ x=; [[ "$x" -eq 6 ]]
$ unset x; [[ "$x" -eq 6 ]]
$ 

```

Arithmetic operators strip whitespace:

```
$ [ '6 ' -eq $'\n\t6' ]; echo $?
0

```

Inside [[ the operands of arithmetic operators are arithmetic expressions, so for example `[[ 4 -eq 2+2 ]]` is true. Numbers that start with 0 are treated as octal numbers:

```
$ [[ 010 -eq 8 ]]; echo $?
0
$ [ 010 -eq 8 ]; echo $?
1

```

I often use = / == even for comparing integers. = and == are equivalent in bash inside both [[ and [. == and [[ are not defined by POSIX.

Word splitting and pathname expansion are not performed inside [[. `[[ $x = $y ]]` treats y as a pattern but `[[ $x = "$y" ]]` treats y literally:

```
$ x=44; y='4*'
$ [[ $x = $y ]]; echo $?
0
$ [[ $x = "$y" ]]; echo $?
1

```
Yes, it is correct. 

Quotes in shells are for different purpose than in other languages. See [this answer](https://unix.stackexchange.com/a/65633/22565) for more details.

In shell, quotes are used to prevent the shell to treat some characters specially and to prevent some operations that the shell would otherwise perform upon some types of expansion (like in this case variable expansion).

Typically, in this case, you want `"$exit_status"` to be expanded to one argument to the `[` command that is the content of that varaible, so you need the quotes.