Skip to content

tools, docs: Parse version.txt using shlex and bash#279

Open
krnowak wants to merge 2 commits intomainfrom
krnowak/shlex-version-txt
Open

tools, docs: Parse version.txt using shlex and bash#279
krnowak wants to merge 2 commits intomainfrom
krnowak/shlex-version-txt

Conversation

@krnowak
Copy link
Member

@krnowak krnowak commented Oct 12, 2023

This is to guard against quoted values.

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-279.westeurope.1.azurestaticapps.net

This is to guard against quoted values.
This guards against possible quotes.
@krnowak krnowak force-pushed the krnowak/shlex-version-txt branch from 156bcb0 to f2dab49 Compare October 26, 2023 06:16
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://lemon-wave-085522403-279.westeurope.1.azurestaticapps.net

@krnowak krnowak changed the title tools: Use shlex for parsing version.txt tools, docs: Parse version.txt using shlex and bash Oct 26, 2023

```shell
VER=$(curl https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep -m 1 FLATCAR_VERSION_ID= | cut -d = -f 2)
VER=$(source <(curl https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION_ID}")
Copy link
Member

Choose a reason for hiding this comment

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

If this should serve as reference for copy paste it would be good to have error reporting with set -euo pipefail still work. The <(CMD) usage swallows the error - maybe an explicit check for a non-empty string could be added before the echo.

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.

2 participants