Saltar al contenido principal

Lab 6.1 - Introducción al Bash Scripting

Objetivos​

  • Crear scripts Bash
  • Utilizar variables
  • Comprender los comandos básicos

Ejercicio 1: Primer Script​

# Crear un script
cat > hello.sh << 'EOF'
#!/bin/bash
echo "Hello Linux!"
echo "Date: $(date)"
echo "User: $USER"
EOF

chmod +x hello.sh
./hello.sh

Ejercicio 2: Variables​

# Script con variables
cat > variables.sh << 'EOF'
#!/bin/bash
NAME="Linux"
VERSION=24.04
echo "Sistema: $NAME $VERSION"
EOF

chmod +x variables.sh
./variables.sh

Lab creado el: diciembre 2024 - Probado en Ubuntu 24.04