I ran across something that didn't work for me, but I see no reason
why it shouldn't. I've tried this on a version of RHEL 7.6, as well as an
up-to-date Arch Linux (coreutils 8.32). I have a script/command pipeline that
extracts the password expiration date from `chage`, and I tried to feed it into
`date`:
But this didn't work, it just printed today's date. I guess this is because a
bare dash/hyphen as a date specifier is ignored. I was able to workaround
the problem by loading the `chage` call into a subshell:
Reading the man/info pages for `date`, it doesn't look like -d/--date accepts
the date DATESTR from standard input. It also doesn't look like a herestring
will work, either. Other coreutils programs do accept a single hyphen
('-') to mean read from standard input, so that's why I figured it would work.
As i was writing this, I saw the -f/--file option, which does allow the
dash/hyphen to mean read from standard input. Here's what just worked for me: