Skip to content

Instantly share code, notes, and snippets.

@snown
Created May 5, 2020 16:24
Show Gist options
  • Save snown/af078b5e98c91c66750b539a64a0e7d7 to your computer and use it in GitHub Desktop.
Save snown/af078b5e98c91c66750b539a64a0e7d7 to your computer and use it in GitHub Desktop.
Dynamic Bashful
#!/usr/bin/env bash
function bashful {
(
local bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)"
if [[ -z ${bashful_path:+x} ]]; then
curl -fsSL https://github.com/jmcantrell/bashful/tarball/master | tar xz -C /tmp/
bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)"
fi
if [[ -z ${bashful_path:+x} ]]; then
echo "Couldn't find bashful"
exit 1
fi
pushd "${bashful_path}"/bin/ >/dev/null
source "${bashful_path}/bin/bashful"
popd >/dev/null
"$@"
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment