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

Community
  • 1
  • 1
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985

1 Answers1

2

You can source your script instead, like so:

. <(wget -O- http://a.com/bootstrap-scrit.sh)
gniourf_gniourf
  • 44,650
  • 9
  • 93
  • 104
  • 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. – Ciro Santilli OurBigBook.com Apr 27 '14 at 12:53
  • @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. – gniourf_gniourf Apr 27 '14 at 12:57