bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] tests/array.tests: using grep -v -e instead of egrep


From: Xiangyu Chen
Subject: [PATCH v2] tests/array.tests: using grep -v -e instead of egrep
Date: Tue, 20 Feb 2024 11:32:50 +0800

From: Xiangyu Chen <xiangyu.chen@windriver.com>

The console ouput lots of egrep warning message, those message causes test case 
fail in diff stage.
According the message, using grep -v -e instead of egrep.

Warning message:
---------------
9d8
< egrep: warning: egrep is obsolescent; using grep -E
31d29
< egrep: warning: egrep is obsolescent; using grep -E
34d31
< egrep: warning: egrep is obsolescent; using grep -E
37d33
< egrep: warning: egrep is obsolescent; using grep -E
41d36
< egrep: warning: egrep is obsolescent; using grep -E
65d59
< egrep: warning: egrep is obsolescent; using grep -E
84d77
< egrep: warning: egrep is obsolescent; using grep -E
---------------

Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
---
[Change log]
v2->v1 according to the comments, using grep -v -e ... instead of grep -E to 
make sure
that it works on old version of gnu grep.
tested with manual, console log as below:

run-array
warning: all of these tests will fail if arrays have not
warning: been compiled into the shell
warning: the BASH_ARGC and BASH_ARGV tests will fail if debugging support
warning: has not been compiled into the shell
PASS: run-array

---
 tests/array.tests | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/array.tests b/tests/array.tests
index d0bb08b..07452ec 100644
--- a/tests/array.tests
+++ b/tests/array.tests
@@ -16,7 +16,7 @@
 set +o posix
 
 set +a
-# The calls to egrep -v are to filter out builtin array variables that are
+# The calls to grep -v -e are to filter out builtin array variables that are
 # automatically set and possibly contain values that vary.
 
 # first make sure we handle the basics
@@ -61,7 +61,7 @@ echo ${a[@]}
 echo ${a[*]}
 
 # this should print out values, too
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 
 unset a[7]
 echo ${a[*]}
@@ -92,11 +92,11 @@ echo ${a[@]}
 readonly a[5]
 readonly a
 # these two lines should output `declare' commands
-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
-declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+readonly -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
+declare -ar | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 # this line should output `readonly' commands, even for arrays
 set -o posix
-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+readonly -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 set +o posix
 
 declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
@@ -111,7 +111,7 @@ b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass)
 
 echo ${b[@]:2:3}
 
-declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -pa | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 
 a[3]="this is a test"
 
@@ -129,7 +129,7 @@ d=([]=abcde [1]="test test" [*]=last [-65]=negative )
 unset d[12]
 unset e[*]
 
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 
 ps1='hello'
 unset ps1[2]
@@ -155,7 +155,7 @@ echo ${vv[0]} ${vv[3]}
 echo ${vv[@]}
 unset vv
 
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | grep -v -e BASH_VERSINFO -e PIPESTATUS -e GROUPS
 
 export rv
 #set
-- 
2.35.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]