2
親シェルでサブシェルの変数を使用できるようにする方法
私は、Webサービスからのレポートの時間を計るために、簡単で汚いスクリプトを作成しました。 BASE_URL='http://example.com/json/webservice/' FIRST=1 FINAL=10000 for report_code in $(seq 1 $FINAL); do (time -p response=$(curl --write-out %{http_code} --silent -O ${BASE_URL}/${report_code}) ) 2> ${report_code}.time echo $response # <------- this is out of scope! How do I fix that? if [[ $response = '404' ]]; then echo "Deleting report # ${report_code}!" rm ${report_code} …