Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Defer the execution of some ~/.bash-files commands, to be non-blocking

Writer Andrew Henderson

I have my .bashrc and .bash_profile being loaded at shell start; except for some export and alias, there's a command that needs a couple of seconds to run:

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

And I need to wait this 2 seconds delay all the times I open a new terminal.

Given that I almost never use NVM and that I don't need it to be ready immediately after shell loading,

  • how can I delay the execution of that command? (e.g. running 10 seconds after the shell is loaded)
  • how can I set the execution of such command to be asynchronous so that it doesn't block the fast loading and readiness of my shell?
10 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy