From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42085A0583; Fri, 20 Mar 2020 07:50:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CA071C024; Fri, 20 Mar 2020 07:50:51 +0100 (CET) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by dpdk.org (Postfix) with ESMTP id 6C8C02BB9 for ; Fri, 20 Mar 2020 07:50:50 +0100 (CET) Received: by mail-lj1-f182.google.com with SMTP id d23so5188813ljg.13 for ; Thu, 19 Mar 2020 23:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tOWjhTjG2AoXDigJtE0oOLgMMgSYWS0HkVY2Cn/8QZE=; b=cYi6zpTYCOVnjtTJUHcOTjyZopTfwywznZBkn6h7TIepa1PuaJZil9DgMY6XU7qj4E 0OylCqoFeh8kF3vT1nD35qbzHTPzOwQXGQSYc0AGliOcQkYFGNfpwakGJytVfhv/NSY1 N84vA8K/0fuxKQSebpEtXEeX768Z9XV/J/C89hEp9bx50nCB+aSBsb+mjN2fAAIShMWd DxdSLXZhVe7cBz1B/BF8l4twvkdv3v34H+hT+tgwOjAIZscwBVYjE2PitQU4oI7nPxm9 f4Dcih28KmlO2wB/t4DT8GfeopI8Nmwc2Ka32IXD23NNO5r8G0q9UmJqtIYUKdA/9a2L RnkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tOWjhTjG2AoXDigJtE0oOLgMMgSYWS0HkVY2Cn/8QZE=; b=cttaU3cgMllpopimAm/R5kQCkOLuJxnAViHlqByROeFT7czG+izb5iZyyD9k7DBWH0 DZxPwRH0c87LDmIZKSCH8H0JZPLCiBQ/XJN3J4xkuxXa+V/I9j2beGyt5YBcEUkzKVE+ tkT0nLKK9WAyGm9xyw/Ylf2d/8Vew5O2EwRPFDOk4o8wlfdfZ2eqtxztFjprevS3IZ6/ lTQlJrZDa4K/xft5x9C1K8pGAyx4IHznBcruJxeQV8zWRsuonA3jA3T3GStkmNg1SaTK DnPsy830hhqXLApnpqo8ZRIlMWQQsAsslpoJZUsGaSIfYin5QeznGBARVT4pBWm/CSAO uNrA== X-Gm-Message-State: ANhLgQ0JYYaPph9GOIfJcFZY9GPaLWrcR28OcStKZguC/1QNRVMqvNf4 miSa4zBJAP+Jq60vv3cgBj65BZtxXUA= X-Google-Smtp-Source: ADFU+vvDBiU+ZiRtQg/SZ7/Rcr9Mlzy3DixZr/tjwF02NKOQIh+ku/JyHiS7KzQtPlpr9liNb873nw== X-Received: by 2002:a2e:8945:: with SMTP id b5mr4355916ljk.140.1584687049739; Thu, 19 Mar 2020 23:50:49 -0700 (PDT) Received: from localhost.localdomain ([39.40.4.60]) by smtp.gmail.com with ESMTPSA id s10sm3049193ljp.87.2020.03.19.23.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 23:50:49 -0700 (PDT) From: Sarosh Arif To: dev@dpdk.org Cc: Sarosh Arif , stable@dpdk.org Date: Fri, 20 Mar 2020 11:50:02 +0500 Message-Id: <20200320065002.5410-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319174423.28378> References: <20200319174423.28378> Subject: [dpdk-dev] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Bugzilla ID: 419 Cc: stable@dpdk.org Signed-off-by: Sarosh Arif --- 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