EXPORT-ARRAY(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

πŸ’– EXPORT-ARRAY πŸ’–

okay bestie, so this is export-array from the General Commands Manual section (section 1, iykyk) β€” and honestly? she's giving "pack up your faves and yeet them into the environment" main character energy. ✨

🌸 NAME 🌸

export-array β€” encode a set of values into an environment variable, then execute a program 🫢

πŸŽ€ SYNOPSIS πŸŽ€

In an execline script:

export-array [-d delim] var { value1 value2 ...  } prog...

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: export-array reads a block of values β€” and yes, that block can absolutely be empty, no judgment πŸ’… (it's a block, cf. execline-block(7), the dedicated block manpage bestie) β€” and then it encodes them straight into the var environment variable.

then it execs into prog. like, it becomes prog. iconic behaviour, no notes. periodt. πŸ’«

couple of rules though, and they are lowkey non-negotiable:

  • var must be given without a dollar! no $, okay? leave the $ at home. 🚫
  • var must not contain the character =. literally do not. πŸ™ˆ

and here's the retrieval tea, because obviously you're gonna want these values back:

A list of values encoded via export-array VAR { value1 value2 ... } can be retrieved via importas -Ssd "" VAR. then ${VAR} will be split into as many words as there are values. πŸŽ‰

A list encoded via export-array -d delim VAR { value1 value2 ... } can similarly be retrieved via importas -Ssd delim VAR.

✨ OPTIONS ✨

  • -d delim β€” encode the list of values using the first character of delim as a terminator. ⚠️ only use this when you know that character does not appear in any of the values! like, fr fr, check first! by default, no terminator or character is specified, and the values are encoded as netstrings. 🧚
bestie warning: that -d character is a terminator, so if it shows up inside your values you're gonna have a bad time. the default netstring encoding exists for a reason, mwah πŸ’‹

πŸ‘‘ SEE ALSO πŸ‘‘

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/export-array.html 🌈

πŸ’œ AUTHORS πŸ’œ

  • Laurent Bercot
  • Lennart Jablonka <humm@ljabl.com> (man page port) πŸ’Œ

and that's the whole page, bestie! πŸŽ‰ this one came from the Debian packaging, dated March 26, 2025, and it's filed under EXPORT-ARRAY(1). go encode some values, slay, and remember: no $ on the var. πŸ«ΆπŸ’…βœ¨

πŸ“¦ where this page comes from