Skip to content

Instantly share code, notes, and snippets.

@ailtonbsj
Last active July 4, 2019 14:52
Show Gist options
  • Save ailtonbsj/6a489e9db3f88b3d6dcb5597c70a2d25 to your computer and use it in GitHub Desktop.
Save ailtonbsj/6a489e9db3f88b3d6dcb5597c70a2d25 to your computer and use it in GitHub Desktop.

Revisions

  1. ailtonbsj renamed this gist Jul 4, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ailtonbsj created this gist May 11, 2019.
    29 changes: 29 additions & 0 deletions expressions-without-if.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #!/bin/bash

    function expressionsWithoutIf {
    A=$1
    B=$2

    [ "$A" -ge "$B" ] ; C=$?
    if [ "$C" == "0" ]; then
    echo "TRUE!"
    else
    echo "FALSE!"
    fi

    C=$((A > B))
    if [ "$C" == "1" ]; then
    echo "TRUE!"
    else
    echo "FALSE!"
    fi

    if [ "$A" -ge "$B" ]; then
    echo "TRUE!"
    else
    echo "FALSE!"
    fi
    }

    expressionsWithoutIf 70 40
    expressionsWithoutIf 70 90