简体   繁体   中英

Need response time and download time for the URLs and write shell scripts for same

I have use command to get response time :

curl -s -w "%{time_total}\n" -o /dev/null https://www.ziffi.com/suggestadoc/js/ds.ziffi.https.v308.js

and I also need download time of this below mentioned js file link so used wget command to download this file but i get multiple parameter out put. I just need download time from it

$ wget --output-document=/dev/null https://www.ziffi.com/suggestadoc/js/ds.ziffi.https.v307.js

please suggest

I think what you are looking for is this:

wget --output-document=/dev/null https://www.ziffi.com/suggestadoc/js/ds.ziffi.https.v307.js 2>&1 >/dev/null | grep = | awk '{print $5}' | sed 's/^.*\=//'

Explanation:

2>&1 >/dev/null | --> Makes sure stderr gets piped instead of stdout

grep = --> select the line that contains the '=' symbol

sed 's/^.*\\=//' --> deletes everything from linestart to the = symbol

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM