Last active
April 26, 2017 02:13
-
-
Save syamgot/310b96b0aee1c3b5aca4fa017af22365 to your computer and use it in GitHub Desktop.
ケイジかセガールか子猫のJPGを縦横サイズを指定してランダムで作成する
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
#!/bin/bash | |
URLS=("http://www.stevensegallery.com" "http://www.placecage.com" "http://placekitten.com") | |
DIR="." | |
# ---------------------------------------- | |
if [ $# -lt 2 ]; then | |
echo "usage: demoimg.sh witdh height" 1>&2 | |
exit 1 | |
fi | |
W=$1 | |
H=$2 | |
if [ $# -eq 3 ]; then | |
O=$3 | |
else | |
T=`date '+%Y%m%d%H%M%S'` | |
O=${DIR}/${T}_${W}_${H}.jpg | |
fi | |
R=$(($RANDOM % ${#URLS[@]})) | |
URL=${URLS[${R}]} | |
curl -so $O ${URL}/${W}/${H} | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
placeholder.sh width height [output_path]