3 ms·
Let's say I want to know how many days since an asset on my web server has been modified. With bash + some standard unix tools, from the top of my head I have t
by ryandrake 10y ago
Let's say I want to know how many days since an asset on my web server has been modified. With bash + some standard unix tools, from the top of my head I have to do something like this:
curl -svo /dev/null http://example.com/file 2>&1 | grep Last-Modified | cut -d ' ' -f 3-
And that's just to get the last modified date in text form. Now I'm writing a script that parses that date and gets today's date, convert them to days, and subtract. YUCK!
Wouldn't it be nice if your shell could do this?
curl(http://example.com/file).response_headers.Last-Modified.subtract(date().now).days
I think it would be nice.
- qwertyuiop924 10y agoYes, but as it stands, most of those would have to be builtins for that to work. I would rather have: curl -j example.com|select headers.Last-Modified|time before now|time to days Where the commands send and receive JSON.