BUGFIX: Fixes shellcheck errors.

* SC2086,SC2162 and SC2250
* Affected files:
* libs/logging.sh and libs/v4l2_control.sh

Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
Stephan Wendel 2021-12-17 22:09:55 +01:00
parent b96c2bd86a
commit be30f9cf19
No known key found for this signature in database
GPG Key ID: F465B83ACBA45639
2 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@ function log_level {
function delete_log {
local devel logfile
logfile="$(get_param "webcamd" log_path | sed "s#^~#$HOME#gi")"
logfile="$(get_param "webcamd" log_path | sed "s#^~#${HOME}#gi")"
devel="$(get_param "webcamd" delete_log 2> /dev/null)"
if [ "${devel}" = "true" ]; then
rm -rf "${logfile}"
@ -50,7 +50,7 @@ function log_msg {
msg="${1}"
prefix="$(date +'[%D %T]') webcamd:"
#Workaround sed ~ to BASH VAR $HOME
logfile="$(get_param webcamd log_path | sed "s#^~#$HOME#gi")"
logfile="$(get_param webcamd log_path | sed "s#^~#${HOME}#gi")"
#Workaround: Make Dir if not exist
if [ ! -d "${logfile}" ]; then
mkdir -p "$(dirname "${logfile}")"

View File

@ -32,18 +32,18 @@ function v4l2_control {
# if not empty do
if [ -n "${v4l2ctl}" ]; then
# Write configured options to Log
log_msg "Device: [cam $cam]"
log_msg "Device: [cam ${cam}]"
log_msg "Options: ${v4l2ctl}"
# Split options to array
IFS=',' read -a opt < <(echo "${v4l2ctl}"); unset IFS
IFS=',' read -ra opt < <(echo "${v4l2ctl}"); unset IFS
# loop through options
for param in "${opt[@]}"; do
# parameter available for device
# needs || true to prevent script to exit
valueless="$(echo "${param}" | cut -d "=" -f1)"
opt_avail="$(v4l2-ctl -d ${device} -L | \
grep -c ${valueless} || true)"
if [ "$opt_avail" -eq "0" ]; then
opt_avail="$(v4l2-ctl -d "${device}" -L | \
grep -c "${valueless}" || true)"
if [ "${opt_avail}" -eq "0" ]; then
log_msg "Parameter '${param}' not available for '${device}'. Skipped."
else
v4l2-ctl -d "${device}" -c "${param}" 2> /dev/null