IMPORTAS(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

πŸ’– IMPORTAS(1) β€” General Commands Manual, but make it group chat πŸ’–

okay so bestie, this is importas from the General Commands Manual, section 1. The whole vibe: swap a literal for an environment variable’s value, then go execute another program. It’s giving β€œtiny transformation, then main character exec.” ✨

🌸 NAME 🌸

importas β€” replace a literal with the value of an environment variable, then execute another program.

✨ SYNOPSIS ✨

importas [-i | -D default] [-u] [-s] [-C | -c] [-N | -n] [-d delim]
         variable envvar prog...
importas -S [-i | -D default] [-u] [-s] [-C | -c] [-N | -n] [-d delim]
         envvar prog...

πŸ¦‹ DESCRIPTION πŸ¦‹

importas fetches the value of envvar from the environment. If neither -D nor -i is given, and envvar is undefined, no word is returned β€” and that is different from the empty word. no cap, literally a whole different creature.

Then importas performs variable substitution (cf. execline-substitute(7)) on prog..., with variable as the key and that fetched string as the value.

After that, it exec(3)s into the modified prog....

When envvar is undefined, and the -D option is not given, any variable substitution (cf. execline-substitute(7)) with variable as the key will return no word. This is true even when the ${variable} form to be substituted happens in the middle of a word (with a prefix and/or a postfix), which means the whole word will be deleted. If that’s not the behaviour you want, use the -D option. fr fr, that caveat is important.

πŸ’… OPTIONS πŸ’…

  • -D default β€” if this is given and envvar is undefined, substitute default for the value of variable instead of no word. For instance, to substitute the empty word, use -D "". cute.
  • -i β€” Insist. If envvar is undefined, importas will not do anything; instead, it will exit 100 with an error message. This has precedence over any -D option. like, it overrides. πŸ‘‘
  • -u β€” Unexport. envvar will be removed from the environment after the substitution. importas -u variable envvar is equivalent to importas variable envvar unexport envvar.
  • -S β€” Import with same name. This option allows variable to be omitted; it will be the same as envvar. In other words, importas -S var is the same as importas var var. slay, less typing.

Other options are used to control the substitution mechanism (cf. execline-transform(7)). The synopsis also shows -s, -C | -c, -N | -n, and -d delim; those are the other substitution-mechanism controls, and this page doesn’t unpack them further β€” execline-transform(7) is the one to read.

πŸ‘‘ SEE ALSO πŸ‘‘

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/importas.html

πŸŽ€ AUTHORS πŸŽ€

  • Laurent Bercot
  • Alexis <flexibeast@gmail.com> (man page port)

πŸ’– and that’s the whole page: Debian, dated June 8, 2024 β€” this is the IMPORTAS(1) moment from the General Commands Manual. bye bestie, go substitute responsibly 🫢

πŸ“¦ where this page comes from