Skip to content

Instantly share code, notes, and snippets.

@unau
Last active August 29, 2015 14:13
Show Gist options
  • Save unau/af89174e5d359f53ffc5 to your computer and use it in GitHub Desktop.
Save unau/af89174e5d359f53ffc5 to your computer and use it in GitHub Desktop.
メモ : コマンドライン引数をそのまま受け付けるような GET な http サービスにリクエストを投げつける shell script ref: http://qiita.com/unau/items/1d757150011d0a1b6478
#!/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