Skip to content

Instantly share code, notes, and snippets.

@rafael-g-depaulo
Last active February 22, 2023 17:21
Show Gist options
  • Save rafael-g-depaulo/6abffe0c83403cbca7f85984223c9230 to your computer and use it in GitHub Desktop.
Save rafael-g-depaulo/6abffe0c83403cbca7f85984223c9230 to your computer and use it in GitHub Desktop.
SCRIPT_FILENAME="setup-env.sh"
function get_script_url() {
curl -s https://api.github.com/users/$1/gists | # list all gists
grep "\"filename\": \"$2\"" -A 5 -B 1 | # get the file object
grep "raw_url" | # get raw_url line
sed 's/.*"raw_url": "\(.*\)",.*/\1/' # extract url
}
sudo -u $USER bash -c "$(curl -s $(get_script_url "rafael-g-depaulo" "setup-env.sh"))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment