sa_008.sh
Nivel 2 — Intermedio Transformar estructura

if/elif a case — control de servicio

Transforma este if/elif/else a case. No uses if ni elif:
Código de referencia / Plantilla
#!/bin/bash ACCION=$1 if [ "$ACCION" = "start" ]; then systemctl start nginx elif [ "$ACCION" = "stop" ]; then systemctl stop nginx elif [ "$ACCION" = "restart" ]; then systemctl restart nginx elif [ "$ACCION" = "status" ]; then systemctl status nginx else echo "Uso: $0 {start|stop|restart|status}" fi
Tu respuesta
// Solución de referencia

          

📋 Sobre este ejercicio

Transforma un control start/stop/restart/status a case.

💡 Pistas (clic para revelar)
💡 start, stop, restart, status son cuatro patrones
💡 El else con el mensaje de uso es '*)'
💡 Cada patrón en su línea, su bloque debajo y ';;'; cierra con 'esac'
📖 Referencia del módulo