1
#!/bin/bash
currentTime=$(date +"%R")
currentdate=$(date +'%m/%d/%Y')
oldtime=$(date +%R -d "50 min ago")
echo "Current time : $currentTime"
echo "Current Date : $currentdate"
echo "Old time : $oldtime"
Response=$(curl -X GET -H "Authorization: Basic Token=" "http://targetserver.company.com:8080/v1/organizations/company/environments/environmentname/stats/apis?select=sum(is_error)&timeRange="$currentdate"%20"$currentTime"~"$currentdate"%20"$oldtime"")
echo -e "the response is: \n $Response"
何も応答がありません。シェルスクリプトのcurl URLでシステム日時/現在の日時を使用する方法を助けてください。シェルスクリプトのcurlコマンドで現在の日付を使用するにはどうすればよいですか?
の可能性のある重複した[シェルスクリプトのカールURLで変数を使用する方法?](http://stackoverflow.com/questions/41875493/how-to-use-a-variable-in -a-curl-url-in-shell-script) – Inian