On Fri, Oct 18, 2024 at 09:30:20AM +0800, Li Zhijian wrote: > SC2086 [1], aka. Double quote to prevent globbing and word splitting. > > Previously, SC2086 will cause error in [[]] or [], for example > $ grep -w line build/meson-logs/testlog.txt > test/monitor.sh: line 99: [: too many arguments > test/monitor.sh: line 99: [: nmem0: binary operator expected > > Firstly, generated diff by shellcheck tool: > $ shellcheck -i SC2086 -f diff test/monitor.sh > > In addition, we have remove the double quote around $1 like below > changes. That's because when an empty "$1" passed to a command will open to '' > it would cause an error, for example > $ ndctl/build/test/list-smart-dimm -b nfit_test.0 '' > Error: unknown parameter "" > > - $NDCTL monitor -c "$monitor_conf" -l "$logfile" "$1" & > + $NDCTL monitor -c "$monitor_conf" -l "$logfile" $1 & > > - jlist=$("$TEST_PATH"/list-smart-dimm -b "$smart_supported_bus" "$1") > + jlist=$("$TEST_PATH"/list-smart-dimm -b "$smart_supported_bus" $1) > > - $NDCTL inject-smart "$monitor_dimms" "$1" > + $NDCTL inject-smart "$monitor_dimms" $1 > > - [[ $1 == $notify_dimms ]] > + [[ "$1" == "$notify_dimms" ]] > > - [ ! -z "$monitor_dimms" ] && break > + [[ "$monitor_dimms" ]] && break > > [1] https://www.shellcheck.net/wiki/SC2086 > Signed-off-by: Li Zhijian <lizhij...@fujitsu.com>
Thanks! Applied to https://github.com/pmem/ndctl/tree/pending with [ alison: edited commit msg/log ] snip