#!/bin/sh
set -ex
curl -k -c cookie.txt --user "username:password" -d "username=username" -d "password=password" "https://example.com/login"
for i in `seq 1 10`
do
sleep 1
curl -k -b cookie.txt --user "username:password" -O "https://example.com/images/$i.jpg"
done
ポイント
- -c cookie.txtでクッキー保存する
- -b cookie.txtでクッキー読み込む
- --userでbasic authに対応する