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 CF94CA0583; Thu, 19 Mar 2020 14:32:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 218351AFF; Thu, 19 Mar 2020 14:32:00 +0100 (CET) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id AECF9F94 for ; Thu, 19 Mar 2020 14:31:58 +0100 (CET) Received: by mail-lj1-f195.google.com with SMTP id u12so2513602ljo.2 for ; Thu, 19 Mar 2020 06:31:58 -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; bh=+96UTX/F/wsjUXXRiT5ReXLJSXe9t5c0zEioSHs1W+Q=; b=NPCf+fu9k1v/ys8ntNtImJlsF9vPz47TozvgblVn/umadNNfGpFvqkFIick51JZBDP TNz9XGoGPjSfNVsROTRKe5MuksfS9w1bZjUsGfPa0iucGNrO08spOKVxrzhiTS4frUTJ syfkJu4PDEXQ1pdbw4KovJ8buaPqZmaoMb1GKwZsrAQzYk0FXWYoBN0eY113Jv0W+452 dvdQkyhKiPmrVeOg3l5R7pW2fX1l1Nmvdw89rzJXPQJepzSW+uKTzXyGEMfH3DkGsHEN MU9THbJ84qnW2pwRAm1w1bWsneQ+Ml3k0l91Z3BJ1wiE/9QRW8LX8Vqs6yN8xlPlQ+k6 yMQA== 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; bh=+96UTX/F/wsjUXXRiT5ReXLJSXe9t5c0zEioSHs1W+Q=; b=STveNsIz2qhEBY++qqu7mVHRiRkgidNI+xJESadyPvSN+/Pr8HnS2uzRKdqjfbODZq ksW8zRoL0wuUIMzB9ZBFzd+aNEsMBrs8UfU1dVXhZBpbv99hpNk+L2H9BaB35RoAX6QD ierPiWBSb2rvCrgiJtAQtPPKF0PXTu6PsdxFWYxTs6yzJCJDM8OAO9COJmHHBA/63qog 4pdv6kOVZsvc3uaN4M6uLVZg5cFJUfZq5pValyyuha1oa6/loMvScbrRS0avfW0nyHrS p7v+5kimS95qZ6FcRTLEyLAYRrUZtNlKO5T4L1za42AqIQc0sij/wWKkte8KOCHuXMlB 1ZBw== X-Gm-Message-State: ANhLgQ3t9wuSk0ZjScm4JL7Y8WjdqmfX+cHv1RbMbu72w66mOwtDAb/E eUH/Wutz6JiYJNWtS0ccNI139zAIZAHDEw== X-Google-Smtp-Source: ADFU+vs3is1lkXgi/K5ZOZxEjaAwGPrm2hVRwv/tra//2hyZYVnFqaiqz4HXdv+5rqyn4cZKGsmeGg== X-Received: by 2002:a2e:86c6:: with SMTP id n6mr2266514ljj.46.1584624717950; Thu, 19 Mar 2020 06:31:57 -0700 (PDT) Received: from localhost.localdomain ([39.40.48.67]) by smtp.gmail.com with ESMTPSA id c20sm1620366lfb.60.2020.03.19.06.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 06:31:57 -0700 (PDT) From: Sarosh Arif To: dev@dpdk.org Cc: Sarosh Arif , stable@dpdk.org Date: Thu, 19 Mar 2020 18:31:47 +0500 Message-Id: <20200319133147.24180-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] 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" Used regular expression to see if the input is numeric, otherwise prompts the user to re-enter. Bugzilla ID: 419 Cc: stable@dpdk.org Signed-off-by: Sarosh Arif --- usertools/dpdk-setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 usertools/dpdk-setup.sh diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh old mode 100755 new mode 100644 index e5bbe9fee..a29fdc677 --- a/usertools/dpdk-setup.sh +++ b/usertools/dpdk-setup.sh @@ -595,8 +595,12 @@ while [ "$QUIT" == "0" ]; do echo -n "Option: " read our_entry echo "" - ${OPTIONS[our_entry]} ${our_entry} + re='^[0-9]+$' + if [[ $our_entry =~ $re ]] ; then + ${OPTIONS[our_entry]} ${our_entry} + fi + if [ "$QUIT" == "0" ] ; then echo echo -n "Press enter to continue ..."; read -- 2.17.1