tldr
i'd like to run an export command in zshrc that takes a while to run. i don't need the env variable immediately but would like to have my command prompt available right away. is there a way to start this command in the background?
background
i'm using docker on osx via boot2docker. i'd like to be able to have an env variable available (DOCKER_HOST) so trying to set that up in zshrc.
the command i need to run though in order to figure out the correct value for DOCKER_HOST can take a few seconds to run:
cd /boot2docker && export DOCKER_HOST="tcp://`vagrant ssh-config | sed -n "s/[ ]*HostName[ ]*//gp"`:2375"
(that command is taken directly from https://github.com/Parallels/boot2docker-vagrant-box)
basically the command does the following:
- enters the
/boot2docker
directory - runs
vagrant ssh-config
and gets the hostname - exports DOCKER_HOST="$HOST_NAME:2375"
but that step #2 can take some time. so putting this command as-is into my ~/.zshrc.local
file causes new terminal windows to take way too long to show the prompt (5-10 seconds!).
i'm wondering if anyone knows a way to run this in the background. i'm ok with the env variable not being available those first 5-10 seconds but i want my prompt to show up and be usable right away!