Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: prepend POSIX utilities with command -p #42

Merged
merged 2 commits into from
Jan 11, 2024
Merged

Conversation

LucasLarson
Copy link
Owner

Prepending POSIX-guaranteed utilities with command -p instead of just command is more dependable. It provides mroe replicability by avoiding potentially hazardous calls to less secure aliases and symbolic links and will fix #41.

Prepending POSIX-guaranteed utilities with `command -p` instead of just
`command` is more dependable. It provides mroe replicability by
avoiding potentially hazardous calls to less secure aliases and
symbolic links.

Fix #41

Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
`command -p -- awk -F '\t' -- '{$2 $1}'` creates a false positive SC2016 error in Shellcheck v0.9.0
`command       awk -F '\t' -- '{$2 $1}'`, which is identical in function, causes no such error

Because it appears that any command that begins `command -p` and contains a single-quoted dollar sign is incorrectly considered an SC2016 error in Shellcheck v0.9.0, this commit replaces the `awk` program with a `sed` command which also provides identical functionality:
`command -p -- sed -e 's/\(.*\)\t\(.*\)/\2\1/'`

Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
@LucasLarson LucasLarson marked this pull request as ready for review January 11, 2024 19:45
@LucasLarson LucasLarson merged commit cd08b7b into main Jan 11, 2024
7 checks passed
@LucasLarson LucasLarson deleted the command_-p branch January 11, 2024 19:54
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.

for utilities POSIX guarantees, use command -p instead of command
1 participant