Expand a PSV row into prefixed shell variables.

SolidGroundUX DocumentationSolidGroundUX
NL

fn: sgnd_dt_row2var

Purpose

Expand a PSV row into prefixed shell variables.

Arguments

  • $1 — Schema.
  • $2 — Prefix for generated variable names.
  • $3 — Pipe-separated row.

Side effects

Creates variables named PREFIX_column using lowercased schema columns and hyphens converted to underscores.

Returns

  • 0 when the schema is valid; 1 otherwise.

Usage

  sgnd_dt_row2var "name|role" person "Ada|admin"
  printf "%s\n" "$person_role"