Skip to content

Instantly share code, notes, and snippets.

@circleous
Created December 1, 2019 13:09
Show Gist options
  • Save circleous/4d67b6289ffaa63ea7df7bee4db53296 to your computer and use it in GitHub Desktop.
Save circleous/4d67b6289ffaa63ea7df7bee4db53296 to your computer and use it in GitHub Desktop.
KOM311 Sistem Operasi - Week 14 - misc command
#!/bin/bash
if [ $# -ne 1 ]; then
echo -e "$0 - get last gists from a user"
echo -e "Usage:"
echo -e "\t$0 <username>\n"
echo -e "Example:"
echo -e "\t$0 circleous"
else
url=`curl -s https://api.github.com/users/$1/gists | grep url | head -n 1 | awk '{print $2}' | sed 's/"\(.*\)",/\1/'`
echo -e "$(curl -s $url | jq -rM .files[].content)"
unset url
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment