This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 6a2c96da0507f5fcff2cf609c2fe1efcc9fff50b
Author: Xing Guo <[email protected]>
AuthorDate: Mon Jun 19 17:21:34 2023 +0800

    Replace 'egrep' with 'grep -E'. (#15804)
    
    Each time we use 'egrep' there's a warning message emitted:
    'egrep: warning: egrep is obsolescent; using grep -E'. This patch
    replaces 'egrep' with 'grep -E'.
    
    Reference:
    - https://www.shellcheck.net/wiki/SC2196
---
 gpMgmt/bin/gpinitsystem             | 4 ++--
 gpMgmt/bin/lib/gp_bash_functions.sh | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gpMgmt/bin/gpinitsystem b/gpMgmt/bin/gpinitsystem
index 394504cd79..72a847a72a 100755
--- a/gpMgmt/bin/gpinitsystem
+++ b/gpMgmt/bin/gpinitsystem
@@ -1330,7 +1330,7 @@ CREATE_QD_DB () {
                export PGPORT=$GP_PORT;$PG_CTL -w -l $GP_DIR/log/startup.log -D 
$GP_DIR -o "-i -p $GP_PORT -c gp_role=utility \
                -m" start >> ${LOG_FILE} 2>&1
                RET_TEXT="`$PG_CTL status -D $GP_DIR`"
-               RUNNING=`$ECHO $RET_TEXT|$EGREP -c "not running|neither"`
+               RUNNING=`$ECHO $RET_TEXT|$GREP -E -c "not running|neither"`
                if [ $RUNNING -ne 0 ]; then
                                $CAT ${GP_DIR}.log|$TEE -a $LOG_FILE
                                ERROR_EXIT "[FATAL]:-Failed to start the 
Coordinator database in admin mode"
@@ -1649,7 +1649,7 @@ SCAN_LOG () {
        LOG_MSG "[INFO]:-Start Function $FUNCNAME"
        LOG_MSG "[INFO]:-Scanning utility log file for any warning messages" 1
        SCAN_STRING="\[WARN\]|invalid|warning:|fatal|error"
-       if [ `$EGREP -i -w "$SCAN_STRING" $LOG_FILE|$GREP -v "\[INFO\]"|$GREP 
-v "[Start|End] Function ERROR_CHK"|$GREP -v "warning: enabling \"trust\" 
authentication for local connections"|$GREP -v "to the list of known 
hosts"|$GREP -v "LOG"|$WC -w` -ne 0 ];then
+       if [ `$GREP -E -i -w "$SCAN_STRING" $LOG_FILE|$GREP -v "\[INFO\]"|$GREP 
-v "[Start|End] Function ERROR_CHK"|$GREP -v "warning: enabling \"trust\" 
authentication for local connections"|$GREP -v "to the list of known 
hosts"|$GREP -v "LOG"|$WC -w` -ne 0 ];then
                LOG_MSG 
"[WARN]:-*******************************************************" 1
                LOG_MSG "[WARN]:-Scan of log file indicates that some warnings 
or errors" 1
                LOG_MSG "[WARN]:-were generated during the array creation" 1
diff --git a/gpMgmt/bin/lib/gp_bash_functions.sh 
b/gpMgmt/bin/lib/gp_bash_functions.sh
index 6c97005e84..ee01ee8147 100755
--- a/gpMgmt/bin/lib/gp_bash_functions.sh
+++ b/gpMgmt/bin/lib/gp_bash_functions.sh
@@ -82,7 +82,6 @@ DIRNAME=`findCmdInPath dirname`
 ECHO=`findCmdInPath echo`
 FIND=`findCmdInPath find`
 GREP=`findCmdInPath grep`
-EGREP=`findCmdInPath egrep`
 HEAD=`findCmdInPath head`
 HOSTNAME=`findCmdInPath hostname`
 IP=`findCmdInPath ip`


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to