Skip to content

changes 'ls | grep' to use find instead - #2075

Merged
larsewi merged 1 commit into
cfengine:masterfrom
SimonThalvorsen:CFE-4587
Jan 8, 2026
Merged

changes 'ls | grep' to use find instead#2075
larsewi merged 1 commit into
cfengine:masterfrom
SimonThalvorsen:CFE-4587

Conversation

@SimonThalvorsen

Copy link
Copy Markdown
Contributor

unpack-tarballs: formatted script with shfmt

unpack-tarballs: formatted script with shfmt
@olehermanse
olehermanse requested a review from larsewi January 7, 2026 16:05
@olehermanse

Copy link
Copy Markdown
Member

@cf-bottom please test this in jenkins

@cf-bottom

Copy link
Copy Markdown

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work 🚀

# > Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.
# TODO: CFE-4587
MASTERFILES_TARBALL=$(ls "$BASEDIR"/output/tarballs/cfengine-masterfiles*.tar.gz | grep -v 'pkg.tar.gz$')
MASTERFILES_TARBALL=$(find "$BASEDIR"/output/tarballs/ -name 'cfengine-masterfiles*.tar.gz' -a ! \( -name '*pkg.tar.gz' \))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these parentheses necessary when there is only one expression inside them?

Suggested change
MASTERFILES_TARBALL=$(find "$BASEDIR"/output/tarballs/ -name 'cfengine-masterfiles*.tar.gz' -a ! \( -name '*pkg.tar.gz' \))
MASTERFILES_TARBALL=$(find "$BASEDIR"/output/tarballs/ -name 'cfengine-masterfiles*.tar.gz' -a ! -name '*pkg.tar.gz' )

@larsewi
larsewi merged commit 9cb1dcc into cfengine:master Jan 8, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants