All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sarosh Arif <sarosh.arif@emumba.com>
To: dev@dpdk.org
Cc: Sarosh Arif <sarosh.arif@emumba.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
Date: Fri, 20 Mar 2020 11:50:02 +0500	[thread overview]
Message-ID: <20200320065002.5410-1-sarosh.arif@emumba.com> (raw)
In-Reply-To: <20200319174423.28378>

Bugzilla ID: 419
Cc: stable@dpdk.org
Signed-off-by: Sarosh Arif <sarosh.arif@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


       reply	other threads:[~2020-03-20  6:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200319174423.28378>
2020-03-20  6:50 ` Sarosh Arif [this message]
2020-04-17 12:50   ` [dpdk-dev] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs Sarosh Arif
2020-05-24 17:04     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-06-01  8:40   ` [dpdk-dev] [PATCH v3] " Sarosh Arif
2020-06-02  7:38     ` [dpdk-dev] [PATCH v4] " Sarosh Arif
2020-07-23 12:13       ` Sarosh Arif
2020-07-23 17:00         ` Stephen Hemminger
2020-07-24 13:29           ` Thomas Monjalon
2020-07-24 14:05             ` Jerin Jacob
2020-11-26 17:54               ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200320065002.5410-1-sarosh.arif@emumba.com \
    --to=sarosh.arif@emumba.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.