Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note how to easily add date as suffix in bash #7601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claell
Copy link

@claell claell commented Jan 27, 2024

Reading the docs, I wondered how this can be achieved.

Might not be wanted as part of the docs, though.

What is the purpose of this change?

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

Reading the docs, I wondered how this can be achieved.

Might not be wanted as part of the docs, though.
@claell
Copy link
Author

claell commented Jan 27, 2024

I just quickly ticked all checkboxes, but didn't really check. After getting feedback, whether this addition to the docs is okay, I'll be happy to comply with the repository requirements for commits and pull requests.

@albertony
Copy link
Contributor

I think its ok to include as an example. Two comments/questions:

  • Is it really bash-only? Or is date a standalone utility, independent of the shell, and works on all/most Linux - even Mac? I'm asking, because I don't know. If so, I see that unfortunately we use a mix of terminology in the docs to cover these, including "Linux/macOS", "Unix systems (Linux, macOS, …)", "Unix systems", "unix like platforms", which could have been cleaned up abit, but for now maybe just pick one... :)
  • Is the format %F fixed, or is it depending on regional settings? From forum I've seen %Y-%m-%d which are more explicit, but if %F is definitively always equivalent then that's better.

PS: On Windows, if using PowerShell, one could achieve the same with $(Get-Date -Format 'yyyy-MM-dd').

Copy link
Member

@ncw ncw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice - thanks! I would be explicit though and write

In bash, this can be done with `--suffix $(date +%F)`.

@claell
Copy link
Author

claell commented Feb 2, 2024

Makes sense!

@albertony:

  • I haven't checked, either. To be sure, I wrote bash, but probably it's applying to all Unix systems.
  • Format: Not sure, I can check

Also nice to see a PowerShell equivalent, might add that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants