[an error occurred while processing this directive]
================================================================================
WORK WITH ME WEDNESDAY - SCRIPTING INTRO
================================================================================

CLASS INFO:
-----------
Topic: [SCRIPTING TOPIC - e.g., "Bash Scripting Fundamentals"]
Date: [YYYY-MM-DD]
Duration: [60 minutes]
Level: [Intermediate]
Instructor: [NAME]

LEARNING OBJECTIVES:
--------------------
By the end of this session, students will be able to:
• [Objective 1 - e.g., Write basic bash scripts]
• [Objective 2 - e.g., Use variables and conditionals]
• [Objective 3 - e.g., Create loops for automation]
• [Objective 4 - e.g., Make scripts executable]

PREREQUISITES:
--------------
• Comfortable with terminal navigation
• Basic understanding of file operations
• Text editor installed (nano, vim, or VS Code)

SETUP (5 MIN):
--------------
1. Create workspace:
   cd ~/Desktop
   mkdir scripting-practice
   cd scripting-practice
2. Verify shell: echo $SHELL
3. Create first script file: touch hello.sh

HANDS-ON EXERCISES:
-------------------

Exercise 1: [TITLE - e.g., "Hello World Script"]
----------------------------------------------------
Script (hello.sh):
  #!/bin/bash
  # My first script
  echo "Hello, World!"
  echo "Today is $(date)"

Commands:
  nano hello.sh          # Edit script
  chmod +x hello.sh      # Make executable
  ./hello.sh             # Run script

Expected output: Hello, World! and current date

Exercise 2: [TITLE - e.g., "Variables and Input"]
----------------------------------------------------
Script (greet.sh):
  #!/bin/bash
  echo "What's your name?"
  read NAME
  echo "Hello, $NAME!"
  echo "Welcome to $0"

Commands:
  chmod +x greet.sh
  ./greet.sh

Expected outcome: Interactive greeting with user input

Exercise 3: [TITLE - e.g., "Conditionals"]
----------------------------------------------------
Script (check_file.sh):
  #!/bin/bash
  FILE=$1
  if [ -f "$FILE" ]; then
    echo "$FILE exists"
    wc -l "$FILE"
  else
    echo "$FILE not found"
  fi

Commands:
  chmod +x check_file.sh
  ./check_file.sh hello.sh
  ./check_file.sh missing.txt

Expected outcome: Different outputs based on file existence

Exercise 4: [TITLE - e.g., "Loops"]
----------------------------------------------------
Script (backup.sh):
  #!/bin/bash
  for file in *.sh; do
    echo "Backing up $file"
    cp "$file" "$file.backup"
  done
  echo "Backup complete!"

Commands:
  chmod +x backup.sh
  ./backup.sh
  ls *.backup

Expected outcome: Backup copies of all .sh files created

Exercise 5: [TITLE - e.g., "Functions"]
----------------------------------------------------
Script (utils.sh):
  #!/bin/bash

  create_folder() {
    FOLDER=$1
    mkdir -p "$FOLDER"
    echo "Created $FOLDER"
  }

  create_folder "test1"
  create_folder "test2"
  create_folder "test3"

Commands:
  chmod +x utils.sh
  ./utils.sh
  ls -d test*

Expected outcome: Three test folders created

COMMON ERRORS & SOLUTIONS:
---------------------------

Error 1: "Permission denied"
Solution: Make script executable with chmod +x script.sh

Error 2: "command not found"
Solution: Run with ./script.sh (not just script.sh)

Error 3: "Syntax error near unexpected token"
Solution: Check spacing around [ ] in conditionals, missing fi/done

Error 4: Variables not expanding
Solution: Use double quotes "$VAR" not single quotes "$VAR"

PRACTICE CHALLENGES:
--------------------
1. [Challenge 1 - e.g., "Create script that organizes files by extension"]
2. [Challenge 2 - e.g., "Write script to check if website is online"]
3. [Challenge 3 - e.g., "Build automated backup script with timestamp"]

CHEAT SHEET:
------------
Script Structure:
  #!/bin/bash           # Shebang line
  # Comment             # Comments start with #

Variables:
  VAR="value"           # Assign (no spaces around =)
  echo $VAR             # Use variable
  $1, $2                # Command line arguments
  $0                    # Script name

Conditionals:
  if [ condition ]; then
    # commands
  elif [ condition ]; then
    # commands
  else
    # commands
  fi

Loops:
  for item in list; do
    # commands
  done

  while [ condition ]; do
    # commands
  done

File Tests:
  [ -f file ]           # File exists
  [ -d dir ]            # Directory exists
  [ -z "$VAR" ]         # Variable is empty
  [ "$A" = "$B" ]       # Strings equal

Functions:
  function_name() {
    # commands
    return 0
  }

Special Variables:
  $?                    # Exit status of last command
  $$                    # Process ID
  $#                    # Number of arguments

RESOURCES & NEXT STEPS:
-----------------------
• Bash guide: https://mywiki.wooledge.org/BashGuide
• ShellCheck.net - script validation tool
• Advanced Bash: https://tldp.org/LDP/abs/html/
• Practice: Write automation scripts for daily tasks
• Next class: [TOPIC]

INSTRUCTOR NOTES:
-----------------
[Add specific notes, student questions, modifications made during class]

================================================================================