4
19
Fork
You've already forked scripts
4

Allow day inputs with leading zeros #1

Merged
rldane merged 2 commits from :main into main 2024年04月09日 05:40:54 +02:00
Contributor
Copy link
No description provided.

The syntax is a little obtuse (as bash can be sometimes). Would you mind adding a comment to the code describing what it does?

The syntax is a little obtuse (as bash can be sometimes). Would you mind adding a comment to the code describing what it does?
Author
Contributor
Copy link

Sure.

Sure.
Author
Contributor
Copy link

There you are.

The $(()) evaluates the expression as arithmetic; in this case, that removes a leading 0. Then the 10# means to interpret it as base-ten; otherwise "08" would be detected as an octal and throw an error.

There you are. The `$(())` evaluates the expression as arithmetic; in this case, that removes a leading 0. Then the `10#` means to interpret it as base-ten; otherwise "08" would be detected as an octal and throw an error.
rldane approved these changes 2024年03月28日 04:55:27 +01:00
Dismissed

Slick! Where did you learn those fancy tricks? Is the 10# something that only works within the arithmetic eval ($(( )))?

Slick! Where did you learn those fancy tricks? Is the 10# something that only works within the arithmetic eval (`$(( ))`)?
Author
Contributor
Copy link

Yeah, I think it's specific to $(()). I'm not 100% sure though.

I think I first learned it when I started scripting automatic tracking of my writing goals, which required a ton of date handling...

Yeah, I think it's specific to `$(())`. I'm not 100% sure though. I think I first learned it when I started scripting automatic tracking of my writing goals, which required a ton of date handling...
rldane closed this pull request 2024年03月28日 17:34:08 +01:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rldane/scripts!1
Reference in a new issue
rldane/scripts
No description provided.
Delete branch ":main"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?