Lab 6.3 - Funciones y Scripting Avanzado
Objetivos
- Crear funciones
- Utilizar arreglos
- Gestionar errores
Ejercicio 1: Funciones
# Script con función
cat > functions.sh << 'EOF'
#!/bin/bash
greet() {
echo "Bonjour $1!"
}
greet "Linux"
EOF
chmod +x functions.sh
./functions.sh
Ejercicio 2: Arreglos
# Arreglos
fruits=("pomme" "banane" "orange")
echo ${fruits[0]}
echo ${fruits[@]}
Lab creado el: diciembre 2024 - Probado en Ubuntu 24.04