Environment Sanity Guard

Easy Shell Configuration Asked at Zoho
Solve this problem

Guard a deployment script by validating every required environment variable up front, checking not just presence but basic format.

Constraints

  • Required: DEVICE_ID, FIRMWARE_PATH, SERVER_URL.
  • DEVICE_ID must be exactly 12 hex characters.
  • FIRMWARE_PATH must exist and be readable.
  • SERVER_URL must start with https://.
  • Report every failure, not just the first.
  • Exit 1 on any failure.
Starter codeShell
1#!/bin/sh2# TODO: validate the environment