4

If I do:

echo 'vim +BundleInstall +qall' | bash

it installs my bundles correctly, but leaves the shell in a bad state (ncurses options) because of the pipe.

Is there a way to prevent the shell from being in a bad state?

Same for the minimal test case: echo 'vim +qall' | bash

Similar to: Run vim command from commandline, but the question there was for an interactive shell, so vim +BundleInstall +qall was fine.

I want to do this to be able to automate Vim plugin installation as:

wget -O- http://a.com/bootstrap-scrit.sh | bash

in a bootstrap script that currently contains vim +BundleInstall +qall. This command can be changed if needed.

Vundle issue: https://github.com/gmarik/Vundle.vim/issues/59

2
  • 1
    Can't you simply execute vim +BundleInstall +qall? Commented Apr 27, 2014 at 11:24
  • @devnull I can, but I would rather do everything automatically, so I can leave my bootstrap script running, come back later when its finished, and start working immediately. Cloning take 5 minutes. Commented Apr 27, 2014 at 11:25

1 Answer 1

2

You can source your script instead, like so:

. <(wget -O- http://a.com/bootstrap-scrit.sh)
Sign up to request clarification or add additional context in comments.

2 Comments

This one made me smile. The only downside is that stuff like variables defined locally in the script will "spill over" to the main shell, but true, this is not very likely to be a problem for a bootstrap script.
@CiroSantilli I was assuming that your script doesn't do anything evil. Hey, it's just a bootstrap script, right? if you really need to define variables and do evil stuff inside your script, you can always enclose the bad parts into parentheses (...) so that these parts are executed inside a subshell and won't alter the main shell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.