Skip to content

Instantly share code, notes, and snippets.

@nevadajames
Last active June 11, 2019 13:28
Show Gist options
  • Select an option

  • Save nevadajames/73b4b017f7b971383e3df81a579b596e to your computer and use it in GitHub Desktop.

Select an option

Save nevadajames/73b4b017f7b971383e3df81a579b596e to your computer and use it in GitHub Desktop.
install pv if absent
#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]] ; then
if ! brew ls --versions pv &> /dev/null ; then
echo "Pipe Viewer is NOT installed!"
brew install pv
fi
else
distro=$(source /etc/os-release && echo "$NAME");
if [[ $distro == *"Debian"* ]] || [[ $distro == *"Ubuntu"* ]]; then
if ! dpkg -l | grep -qw pv &> /dev/null ; then
echo "Pipe Viewer is NOT installed!"
apt-get update -y
apt-get install -y pv
fi
elif [[ $distro == *"Manjaro"* ]]; then
echo "what package manager?"
else
echo "Pipe View package must be installed for your system: $distro"
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment