#!/bin/bash # Function to display usage information usage() { echo "Usage: $0 -a \"serial,model,capacity,TBW,smart\"" exit 1 } # Check if the correct number of arguments is provided if [ "$#" -ne 2 ]; then usage fi # Parse command-line arguments while getopts ":a:" opt; do case ${opt} in a) # Extract the comma-separated list of attributes IFS=',' read -ra ATTRS <<< "$OPTARG" ;; \?) echo "Invalid option: $OPTARG" 1>&2 usage ;; esac done shift $((OPTIND -1)) # Check if the database file exists, otherwise create it and initialize the table DB_FILE="drive_records.db" if [ ! -f "$DB_FILE" ]; then sqlite3 "$DB_FILE" <