olivares33561 via users wrote: > Dear Will, thanks for your help. I was able to do it. > The following does the job! > ------ > #!/bin/bash > start=$1 > end=$2 > > start=$(date -d $(echo $start | sed 's/\./-/g') +%Y%m%d) > end=$(date -d $(echo $end | sed 's/\./-/g') +%Y%m%d) This is a minor improvememnt, but you can eliminate the call to sed and use parameter expansion. Instead of: echo $start | sed 's/\./-/g' use: echo ${start//./-} In a small script it won't make a huge difference in speed, but if you do something which uses a large number of loop iterations it can be noticeable. If nothing else, it is a good bit shorter. > date -d"$start" +%Y.%m.%d > > while [[ $start -lt $end ]] Also not hugely important here, or at the root of your question, you can use `((` rather than `[[` to simplify the arithmetic evalution, i.e.: while (( start < end )) (You can use or not use `$` before the variable within bash's arithmetic evalution context.) -- Todd
Attachment:
signature.asc
Description: PGP signature
-- _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue