(Voy a trabajar en éste artículo a ratos, me dejo la estructura para ir rellenando.) |
(→Evaluación If-Then) |
||
| Línea 22: | Línea 22: | ||
=== Evaluación If-Then === | === Evaluación If-Then === | ||
| + | |||
| + | |||
| + | <source lang="bash"> | ||
| + | #!/bin/bash | ||
| + | |||
| + | echo "Introduce tu Edad" | ||
| + | read edad | ||
| + | |||
| + | if [[ $edad -gt 18 ]] | ||
| + | then | ||
| + | echo "Eres Mayor de Edad" | ||
| + | else | ||
| + | if test $edad -lt 18 -a $edad -gt 13 | ||
| + | then | ||
| + | echo "Estás en plena edad del pavo.. brrrlll" | ||
| + | fi | ||
| + | fi | ||
| + | |||
| + | </source> | ||
== Bucles == | == Bucles == | ||
Contenido |
<source lang="bash">
echo "Introduce tu Edad" read edad
if $edad -gt 18 then
echo "Eres Mayor de Edad"
else
if test $edad -lt 18 -a $edad -gt 13
then
echo "Estás en plena edad del pavo.. brrrlll"
fi
fi
</source>