Complete bash-script toolkit with generation and validation capabilities
97
97%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
A developer has silenced all ShellCheck SC2086 (unquoted variables) and SC2046 (word-splitting in command substitution) warnings globally. The script processes filenames intentionally with word splitting in one specific place but should be quoted everywhere else.
#!/usr/bin/env bash
# shellcheck disable=SC2086,SC2046
WORKSPACE=$1
FILES_TO_PROCESS=$2 # intentionally space-separated list
process_files() {
for f in $FILES_TO_PROCESS; do # intentional: FILES_TO_PROCESS is a space-separated list
cp $f $WORKSPACE/processed/
chmod 644 $WORKSPACE/processed/$f
done
}
build_index() {
wc -l $(find $WORKSPACE -name "*.txt")
}
cleanup() {
rm -rf $WORKSPACE/tmp
}
process_files
build_index
cleanupYour tasks:
generator
validator