Skip to main content
ubx shell spawns an interactive shell (or runs a specific command) with all stack outputs injected as environment variables, plus UBX_ENV and UBX_STACK meta-variables.

Usage

ubx shell [-- command [args...]] [flags]

Flags

FlagDescription
--no-injectSkip output injection; only UBX_ENV and UBX_STACK are set

Examples

ubx shell                               # spawn interactive $SHELL with outputs
ubx shell -- psql $DATABASE_URL         # run a command with outputs
ubx shell -- bash -c 'echo $VPC_ID'    # inline command
ubx shell --no-inject                   # shell without output injection
ubx shell --env prod                    # use prod stack outputs

What gets injected

All non-secret stack outputs:
  • Keys uppercased: vpc_idVPC_ID
  • Non-alphanumeric chars → _
  • Secrets are not injected
  • Objects/arrays become compact JSON strings
Plus meta-variables:
  • UBX_ENV — current environment name
  • UBX_STACK — current stack name

Interactive shell

Without a command argument, ubx shell spawns $SHELL (or /bin/sh if $SHELL is not set):
  ◆ Shell       injecting 5 output(s) into environment
  ◆ Shell       spawning /bin/zsh

$ echo $VPC_ID
vpc-0a1b2c3d4e5f67890

$ exit
  ✓  shell exited

Error handling

If stack outputs cannot be loaded (e.g. stack hasn’t been deployed yet), ubx emits a warning and spawns the shell without injected output variables:
  Warning: could not load stack outputs (no .ubx/ dir) — spawning shell without injected vars
  • ubx exec — non-interactive command runner (experimental)
  • ubx output — display outputs in various formats