Last active
August 29, 2015 14:13
-
-
Save unau/af89174e5d359f53ffc5 to your computer and use it in GitHub Desktop.
メモ : コマンドライン引数をそのまま受け付けるような GET な http サービスにリクエストを投げつける shell script ref: http://qiita.com/unau/items/1d757150011d0a1b6478
This file contains 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 | |
#kicker=wget | |
kicker=curl | |
host=localhost | |
port=19876 | |
path=`for a in "$@"; do echo $a; done | awk -F '' 'BEGIN{OFS=ORS="";for(i=0;i<256;i++)o[sprintf("%c",i)]=i}{for(i=1;i<=NF;i++)$i=($i ~ /[[:alnum:]]/)?$i:"%" sprintf("%02X",o[$i])}{print "/" $0}'` | |
url=http://${host}:${port}${path} | |
$kicker $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment