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

Sarosh Arif sarosh.arif at emumba.com
Fri Apr 17 14:50:22 CEST 2020


Hello,
If there is no objection on this patch then it can perhaps be applied.

On Fri, Mar 20, 2020 at 11:50 AM Sarosh Arif <sarosh.arif at emumba.com> wrote:

> Bugzilla ID: 419
> Cc: stable at dpdk.org
> Signed-off-by: Sarosh Arif <sarosh.arif at emumba.com>
> ---
>  usertools/dpdk-setup.sh | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
> index e5bbe9fee..c27f89c5f 100755
> --- a/usertools/dpdk-setup.sh
> +++ b/usertools/dpdk-setup.sh
> @@ -592,11 +592,17 @@ while [ "$QUIT" == "0" ]; do
>         echo "[$OPTION_NUM] Exit Script"
>         OPTIONS[$OPTION_NUM]="quit"
>         echo ""
> -       echo -n "Option: "
> -       read our_entry
> +       read -p "Option: " our_entry
> +       [ $? -eq 0 ] || exit 0
> +
>         echo ""
> -       ${OPTIONS[our_entry]} ${our_entry}
> -
> +       numeric="^[[:digit:]]+$"
> +       if [[ "$our_entry" =~ $numeric ]]; then
> +               ${OPTIONS[our_entry]} ${our_entry}
> +       else
> +               echo "Please enter a numeric value"
> +       fi
> +
>         if [ "$QUIT" == "0" ] ; then
>                 echo
>                 echo -n "Press enter to continue ..."; read
> --
> 2.17.1
>
>


More information about the dev mailing list