
Ask HN: Best one liner to install bash script - shincert
I&#x27;m working on a bash script and I want to make available a simple one-liner that automatically downloads and runs the install script. I&#x27;ve seen many variations of this one-liner. For example oh-my-zsh uses<p>sh -c &quot;$(curl -fsSL https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;robbyrussell&#x2F;oh-my-zsh&#x2F;master&#x2F;tools&#x2F;install.sh)&quot;<p>What&#x27;s the best way to do it? Or the most simple&#x2F;pure? Is there maybe a blog post outlining the different ways?
======
dozzie
Please don't. Running random scripts from the internets to install stuff is a
idiotic idea that deserves to die already.

Make your build process dumb and installation process even dumber. The former
should just run the compiler (as opposed to downloading and installing semi-
related stuff; this belongs elsewhere), and the latter should just copy files.
This way somebody could easily make a tarball or RPM/DEB package, which allows
for repeatable installations. Running sh&t from the internets doesn't allow to
reliably build packages and install software.

Don't assume that your users are idiots who cannot run two or three commands
in terminal.

------
melezhik
Hi! Take a look at sparrow - script package manager -
[https://sparrowhub.org](https://sparrowhub.org) as easy way to distribute
portable scripts across servers.

------
whatnotests
try this:

curl [https://example.com/file.sh](https://example.com/file.sh) | bash

If your shell script needs sudo access, just:

curl [https://example.com/file.sh](https://example.com/file.sh) | sudo bash

