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 2726DA0583 for ; Fri, 20 Mar 2020 07:50:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 14DD52BB9; Fri, 20 Mar 2020 07:50:51 +0100 (CET) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by dpdk.org (Postfix) with ESMTP id 2C3D12BB9 for ; Fri, 20 Mar 2020 07:50:50 +0100 (CET) Received: by mail-lj1-f172.google.com with SMTP id u12so5275843ljo.2 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=rC13kMRNOJ9PkjSvwlQoiNTvDvalNyi6O9aN4P1BAhWJjUl6aeOjKmXUYXsK+HdjOT cnbU9Q7FCIqkJE1CNk/zKHDlFMVMq1oNGC5RS6ZQ8KxNvUXEB7/RB/4i1bdaDa9MEqz+ d13QVp6f7CH5rA4g+a3hvXIi+uLQpM1f1lI6uQhJSGKKEuNGTt9CTxbm0FdAE4l3UXQY 5UDeqDuB5O4SKy5gEJ4KHptSqtqFnzpoTF9dIumI0k1zG88yyR0rLpx3N38iDm47i21H cPQbkJKIUYuwU/+mM6HCFYiyQDVYasim+ofj7OBjbD22ck2e4YluufzV01d6ytWAvVCV RugQ== X-Gm-Message-State: ANhLgQ2jdtR2377h3pa8E9rJP+k2jBUWaD0lsiRZtSDpl+wbrLjJ0eyi FucQxo+kEvPV+iWB9ZuSAzLy9g== 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-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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