Lab 19: Shell Scripting Basics
Objective
Step 1: Your First Script
cat > /tmp/hello.sh << 'EOF'
#!/bin/bash
NAME=${1:-World}
echo "Hello, $NAME!"
echo "Today is: $(date +%A)"
echo "You are running bash $BASH_VERSION"
EOF
chmod +x /tmp/hello.sh
/tmp/hello.shHello, World!
Today is: Thursday
You are running bash 5.1.16(1)-releaseStep 2: Variables and Arguments
Step 3: if / elif / else
Step 4: for Loop
Step 5: while Loop
Step 6: Functions
Step 7: Exit Codes
Step 8: Capstone — System Health Check Script
Summary
Concept
Syntax
Last updated
