Last active
October 10, 2022 04:05
-
-
Save xbalaji/aad039751ec43e7eb1052d6aabcdaa82 to your computer and use it in GitHub Desktop.
download a single github file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# github-download-file.sh | |
github_download_file() | |
{ | |
fileurl=$(echo ${2} | sed -e 's,github.com,api.github.com/repos,;s,blob/master,contents,') | |
curl -sqk -H "Authorization: token ${1}" -H "Accept: application/vnd.github.v3.raw" -O -L "${fileurl}" | |
} | |
# call like: github_download_file $MY_TOKEN "https://github.com/xbalaji/xbenv/blob/master/gvimrc.html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment