Skip to content

Instantly share code, notes, and snippets.

@silvernode
Created October 22, 2015 11:57
Show Gist options
  • Save silvernode/7f32d8838ca0a7cc65e3 to your computer and use it in GitHub Desktop.
Save silvernode/7f32d8838ca0a7cc65e3 to your computer and use it in GitHub Desktop.
#use which to find package manager
#package managers to check for
pkgMgrs = ["apt-get",
"pacman"]
#iterate over list of package managers
#pass this to which(), take result and set it to pkgMgr
for i in pkgMgrs do
if which(i) then
pkgMgr=i
break
end
end
#pkgMgr should now be set to either apt-get or pacman
#I have functions already made: apt-get() and pacman()
#since I don't know which result pkgMgr is going to have,
#I want to simply load the correct function automatically
$pkgMgr()
#however this doesn't seem to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment