Artificial intelligent assistant

Unintended quotation marks appearing in grim file name I don't quite understand why I am getting some odd behavior trying to generate a screenshot file name when using grim/slurp. If I do this: grim -g "$(slurp)" "$HOME/screenshot-$(date).png" I get: screenshot-Sat 27 Jun 2020 06:02:36 PM EDT Which is ok except that the time does not sort in my file folder. So, I tried this: grim -g "$(slurp)" "$HOME/screenshot-$(date +\"%y%m%d_%T\").png" But in that case I get this: screenshot-"200627_19:35:39.png" Can someone explain why quotation marks are appearing around the whole date string (none are in the expression), and how to elminate them?

`$()` creates a new quoting context, so you don't need to escape quotes inside it. That's one of the reasons why `$()` is preferred to ````, in which mixing nesting and quotes would lead to a nightmare.

For comparison:


$ echo "screenshot-$(date +\"%y%m%d_%T\").png"
screenshot-"200701_14:56:19".png
$ echo "screenshot-`date +\"%y%m%d_%T\"`.png"
screenshot-200701_14:56:27.png


You can leave the backslashes out and just use `"screenshot-$(date +"%y%m%d_%T").png"`. Or, since `%` and the others aren't special, just leave the inner quotes out altogether:


$ echo "screenshot-$(date +%y%m%d_%T).png"
screenshot-200701_14:57:23.png

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 68b78dc21ef7e53a27c03b07b2f4f605