I've got a couple flags in my zsh configuration - and I've been trying to figure out a way to startup a new shell with them set, but haven't found a solution yet. Any suggestions? For example, I'm looking to do something like:
zsh --login --export=RC_BOOTSTRAP:true,RC_DEBUG:true
Edit 01
Essentially, I'm trying to setup custom shell options. The best method I've come up with so far is:
# set the flags as environment variables and restart the shell
exec env RC_BOOTSTRAP=true RC_DEBUG=true zsh --login
And in my startup files, I have:
# I don't want these flags to propagate into additional shells
# so they need to be 'unexported'
RC_TMP_BOOTSTRAP=${RC_BOOTSTRAP:-false} && unset RC_BOOTSTRAP
RC_BOOTSTRAP=${RC_TMP_BOOTSTRAP} && unset RC_TMP_BOOTSTRAP
RC_TMP_DEBUG=${RC_DEBUG:-false} && unset RC_DEBUG
RC_DEBUG=${RC_TMP_DEBUG} && unset RC_TMP_DEBUG
This works, but it's pretty ugly. Any suggestions?
Edit 02
Based on the solution by @gilbert:
exec env RC_FLAGS='RC_BOOTSTRAP=true RC_LOG_LEVEL=4' zsh --login
[[ -n $RC_FLAGS ]] && { eval "$RC_FLAGS"; unset RC_FLAGS; }