Skip to main content
Added specifics to a sentence.
Source Link
Timothy Martin
  • 8.9k
  • 1
  • 37
  • 41

For testing integers you will want to use:

-eq  #Is equal
-ne  #Is not equal
-lt  #Less than
-le  #Less than or equal
-gt  #Greater than
-ge  #Greater than or equal

So your test statement should read:

if  [ "$4" -gt 0 ];

Additionally, your if statement is missing the then so it should be corrected to:

if  [ "$4" -gt 0 ]; then

See man test for more detailtest options.

For testing integers you will want to use:

-eq  #Is equal
-ne  #Is not equal
-lt  #Less than
-le  #Less than or equal
-gt  #Greater than
-ge  #Greater than or equal

So your test statement should read:

if  [ "$4" -gt 0 ];

Additionally, your if statement is missing the then so it should be corrected to:

if  [ "$4" -gt 0 ]; then

See man test for more detail.

For testing integers you will want to use:

-eq  #Is equal
-ne  #Is not equal
-lt  #Less than
-le  #Less than or equal
-gt  #Greater than
-ge  #Greater than or equal

So your test statement should read:

if  [ "$4" -gt 0 ];

Additionally, your if statement is missing the then so it should be corrected to:

if  [ "$4" -gt 0 ]; then

See man test for more test options.

Source Link
Timothy Martin
  • 8.9k
  • 1
  • 37
  • 41

For testing integers you will want to use:

-eq  #Is equal
-ne  #Is not equal
-lt  #Less than
-le  #Less than or equal
-gt  #Greater than
-ge  #Greater than or equal

So your test statement should read:

if  [ "$4" -gt 0 ];

Additionally, your if statement is missing the then so it should be corrected to:

if  [ "$4" -gt 0 ]; then

See man test for more detail.