[dpdk-dev] [PATCH] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs

Stephen Hemminger stephen at networkplumber.org
Thu Mar 19 16:17:33 CET 2020


On Thu, 19 Mar 2020 18:31:47 +0500
Sarosh Arif <sarosh.arif at emumba.com> wrote:

> -	${OPTIONS[our_entry]} ${our_entry}
>  
> +	re='^[0-9]+$'
> +	if  [[ $our_entry =~ $re ]] ; then
> +	${OPTIONS[our_entry]} ${our_entry}
> +	fi
> +

Some comments:
1. Use same indentation style as the rest of the script
   This follows the mantra that all repairs should like
   the original code.
2. If user gives bad data, an error should be printed
   and not silently ignored.
3.The variable "re" doesn't need to be a temporary variable.

4. The [[ construct is a bash only thing, and not used elsewhere
   in the script.



More information about the dev mailing list