fork download
  1. #!/usr/bin/env bash
  2. clear
  3. printf "Capter 10 : Control Structures\n\a"
  4. printf "Capítulo 10 : Estructuras de Control\n"
  5. printf "Section 10.2: If statement\n"
  6. printf "Sección 10.2: Sentencia If\n"
  7. sleep 3
  8.  
  9. printf "\n********** Las opciones de esta sección son: **********\n\n"
  10.  
  11. function.10.02.0 () {
  12. if [[ $1 -eq 1 ]]; then
  13. echo "1 was passed in the first parameter";
  14. elif [[ $1 -gt 2 ]]; then
  15. echo "2 was not passed in the first parameter";
  16. else
  17. echo "The first parameter was not 1 and is not more than 2.";
  18. fi;
  19. return 0;
  20. }
  21.  
  22. declare -f function.10.02.0;
  23.  
  24. echo;
  25.  
  26.  
Success #stdin #stdout #stderr 0.01s 5304KB
stdin
Standard input is empty
stdout
Capter   10  : Control Structures
Capítulo 10  : Estructuras de Control
Section  10.2: If statement
Sección  10.2: Sentencia If

********** Las opciones de esta sección son: **********

function.10.02.0 () 
{ 
    if [[ $1 -eq 1 ]]; then
        echo "1 was passed in the first parameter";
    else
        if [[ $1 -gt 2 ]]; then
            echo "2 was not passed in the first parameter";
        else
            echo "The first parameter was not 1 and is not more than 2.";
        fi;
    fi;
    return 0
}

stderr
TERM environment variable not set.