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

Tidy up settings script #2593

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
settings: fix ifs hack
  • Loading branch information
trn1ty committed May 20, 2024
commit 5fd4183a1ace2ac18fb9f408cff16365eaff7dfc
12 changes: 2 additions & 10 deletions settings
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,13 @@ output="$(printf '%s\n' "$output" | sed '/^$/d')"

echo "Output: ${output}EOO"

settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')"

settingnumber=1

PREIFS="$IFS"
IFS='|'
for name in $settings
for setting in "$DIRECTORY"/etc/setting-params/*
do
curval="$(printf '%s\n' "$output" | sed -n "${settingnumber}p")"

printf 'Setting "%s" to "%s"' "$name" "$curval"
printf 'Setting "%s" to "%s"' "$setting" "$curval"
printf "$curval\n" >"$DIRECTORY/data/settings/$name"

settingnumber=$(printf '1 + %s\n' "$settingnumber" | bc)
done
IFS="$PREIFS"