potiuk edited a comment on pull request #21145: URL: https://github.com/apache/airflow/pull/21145#issuecomment-1025659012
You can read more about the bash magic you can do with variable substitution (this is the exact name of what we do here) https://tldp.org/LDP/abs/html/parameter-substitution.html Also what's part of the magic here: * `${1//[.-]/ }` - the 'space' between `/` and `}` matter - this is how we get the parameters to be separated - basically we replace any `.` or `-` with space with this construct. The `//` means that this is "global" replacement - so it will replace "all" `.` and `-` found not only the first (`${1/[.-]/ }` only replaces the first it finds). * It is important that there is no `"` around it. The `printf "%03d%03d%03d%.0s" "${1//[.-]/ }"` would not work because the "2 20 1" would be seen as a single parameter, but if you do not add `"` the space we added in the previous step, makes each part of the number a separate parameter to `printf`. This is kinda unusual use and usually you want those quotes. This is why shellcheck (our pre-commit static check for bash code) complained and this is why I had to add ` # shellcheck disable=SC2086,SC2183 ` to stop it from complaining. Now I think you should know why we want to get rid of Bash :). If explaining one line of bash takes 2-3 paragraph of text, it means that we should get rid of it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
