Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 2
    This is far and away the smartest answer on here Commented Feb 23, 2019 at 11:34
  • 2
    Use this answer, it is far more robust as it does not rely on an external command. Commented Jun 13, 2020 at 22:20
  • 1
    That will not work in POSIX shell: Commented May 18, 2022 at 12:47
  • 1
    @sena You're right it won't. So just use [ ] instead of [[ ]]. Commented Jul 13, 2022 at 17:10
  • 2
    @TrippKinetics I just realized that you can also quote the >, so [ 2023-02-15 \> 2023-01-01 ] && echo ok works. Commented Feb 15, 2023 at 4:20