Skip to content

Instantly share code, notes, and snippets.

@candu
Created November 7, 2014 18:13
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save candu/33b256292c492f154ade to your computer and use it in GitHub Desktop.
Save candu/33b256292c492f154ade to your computer and use it in GitHub Desktop.
Command-line Lorem Ipsum generator using curl, lipsum.com, and jq
#!/bin/sh
AMOUNT=5
WHAT=paras
START=false
while getopts ":n:wpbls" opt; do
case $opt in
n)
AMOUNT=$OPTARG
;;
w)
WHAT=words
;;
p)
WHAT=paras
;;
b)
WHAT=bytes
;;
l)
WHAT=lines
;;
s)
START=true
;;
*)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
curl -s -X POST lipsum.com/feed/json -d "amount=$AMOUNT" -d "what=$WHAT" -d"start=$START" | jq -r '.feed.lipsum'
@djzort
Copy link

djzort commented Dec 24, 2018

fyi it seems to need to be https://lipsum.com now

@kkew3
Copy link

kkew3 commented Apr 5, 2023

It seems to require "lists" rather than "lines" now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment