Last active
December 14, 2018 07:31
-
-
Save josephok/61a6f3a7debc5cb9dede6fa2f18f927d to your computer and use it in GitHub Desktop.
Generate a random name based on https://randomuser.me/api/
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
#!/usr/bin/env bash | |
which jq &> /dev/null | |
if [[ $? -ne 0 ]] | |
then | |
echo "Please install jq first, see https://stedolan.github.io/jq/" | |
exit 1 | |
fi | |
name=$(curl -s https://randomuser.me/api/) | |
title=$(echo $name | jq .results[0].name | jq .title | sed 's/"//g') | |
first=$(echo $name | jq .results[0].name | jq .first | sed 's/"//g') | |
last=$(echo $name | jq .results[0].name | jq .last | sed 's/"//g') | |
echo "Hello ${title^}. ${first^} ${last^}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment