Lab 6.1 - Introduction to Bash Scripting
Objectives
- Create Bash scripts
- Use variables
- Understand basic commands
Exercise 1: First Script
# Create a script
cat > hello.sh << 'EOF'
#!/bin/bash
echo "Hello Linux!"
echo "Date: $(date)"
echo "User: $USER"
EOF
chmod +x hello.sh
./hello.sh
Exercise 2: Variables
# Script with variables
cat > variables.sh << 'EOF'
#!/bin/bash
NAME="Linux"
VERSION=24.04
echo "System: $NAME $VERSION"
EOF
chmod +x variables.sh
./variables.sh
Lab created on: December 2024 - Tested on Ubuntu 24.04