Skip to content

Commit

Permalink
fix: move egrep -> grep -E
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo committed Aug 19, 2023
1 parent 44704e3 commit fcdab4d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions refresh-contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (C) 2018-2023 Pablo Iranzo Gómez <[email protected]>

# Find files that misses the header:
# for file in $(find . -type f|grep -v .git|grep -v pyc|grep -v .risu_tests|egrep '(.py|.txt|.yml|.sh)$'); do grep -q "^# Modifications" $file|| echo $file;done
# for file in $(find . -type f|grep -v .git|grep -v pyc|grep -v .risu_tests|grep -E '(.py|.txt|.yml|.sh)$'); do grep -q "^# Modifications" $file|| echo $file;done

# How to use:
# python setup.py sdist # To create AUTHORS
Expand Down Expand Up @@ -97,7 +97,7 @@ def main():
date = ""

command = (
"cd $(dirname %s) && git blame -C -M -w -e %s | awk '{print $2\" \"$3\" \"$4}'|egrep -o '<.*>.*[0-9][0-9][0-9][0-9]-' | sed 's/ */ /g' | cut -d ' ' -f 1-2 | sort -u|grep -v not.committed.yet"
"cd $(dirname %s) && git blame -C -M -w -e %s | awk '{print $2\" \"$3\" \"$4}'|grep -E -o '<.*>.*[0-9][0-9][0-9][0-9]-' | sed 's/ */ /g' | cut -d ' ' -f 1-2 | sort -u|grep -v not.committed.yet"
% (plugin["plugin"], plugin["plugin"])
)

Expand Down
10 changes: 5 additions & 5 deletions risuclient/common.d/00-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ is_process() {
is_lineinfile() {
# $1: regexp
# $*: files
[ -f "$2" ] && egrep -iq "$1" "${@:2}"
[ -f "$2" ] && grep -E -iq "$1" "${@:2}"
}

discover_rhrelease() {
FILE="${RISU_ROOT}/etc/redhat-release"
if [[ ! -f ${FILE} ]]; then
echo 0
else
VERSION=$(egrep -o "\(.*\)" ${FILE} | tr -d "()")
VERSION=$(grep -E -o "\(.*\)" ${FILE} | tr -d "()")
case ${VERSION} in
Plow) echo 9 ;;
Ootpa) echo 8 ;;
Expand Down Expand Up @@ -255,7 +255,7 @@ discover_os() {
# Function removing comments (pound sign) and trimming leading and ending spaces
strip_and_trim() {
local file="$1"
egrep -v "^\s*($|#.*)" ${file} | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'
grep -E -v "^\s*($|#.*)" ${file} | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'
}

is_filemode() {
Expand Down Expand Up @@ -289,8 +289,8 @@ expand_ranges() {

expand_and_remove_excludes() {
RANGE=$(expand_ranges $*)
CPUs=$(echo ${RANGE} | tr " " "\n" | egrep -v "\^.*")
EXCLUDES=$(echo ${RANGE} | tr " " "\n" | egrep "\^.*")
CPUs=$(echo ${RANGE} | tr " " "\n" | grep -E -v "\^.*")
EXCLUDES=$(echo ${RANGE} | tr " " "\n" | grep -E "\^.*")
(
for CPU in ${CPUs}; do
exclude=0
Expand Down
4 changes: 2 additions & 2 deletions risuclient/common.d/01-dpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
is_dpkg() {
PACKAGE=$1
if [ "x$RISU_LIVE" = "x1" ]; then
dpkg -l *$1* 2>&1 | grep -v 'no packages found matching' | egrep ^ii | awk -v PACKAGE=${PACKAGE} '$2==PACKAGE {print $3}' | egrep "."
dpkg -l *$1* 2>&1 | grep -v 'no packages found matching' | grep -E ^ii | awk -v PACKAGE=${PACKAGE} '$2==PACKAGE {print $3}' | grep -E "."
elif [ "x$RISU_LIVE" = "x0" ]; then
is_required_file "${RISU_ROOT}/installed-debs"
awk -v PACKAGE=${PACKAGE} '$2==PACKAGE {print $3}' "${RISU_ROOT}/installed-debs" | egrep "."
awk -v PACKAGE=${PACKAGE} '$2==PACKAGE {print $3}' "${RISU_ROOT}/installed-debs" | grep -E "."
fi
}

Expand Down
4 changes: 2 additions & 2 deletions risuclient/common.d/01-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

is_rpm() {
if [ "x$RISU_LIVE" = "x1" ]; then
rpm -qa *$1* | egrep ^"$1"-[0-9]
rpm -qa *$1* | grep -E ^"$1"-[0-9]
elif [ "x$RISU_LIVE" = "x0" ]; then
is_required_file "${RISU_ROOT}/installed-rpms"
awk '{print $1}' "${RISU_ROOT}/installed-rpms" | egrep ^"$1"-[0-9]
awk '{print $1}' "${RISU_ROOT}/installed-rpms" | grep -E ^"$1"-[0-9]
fi
}

Expand Down
10 changes: 5 additions & 5 deletions risuclient/plugins/core/CCN-STIC/619/logindefs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ if [[ ${RH_RELEASE} -gt 8 ]]; then
fi
done
fi
PASS_MAX_DAYS=$(egrep ^PASS_MAX_DAYS ${FILEDEFS} | awk '{print $2}')
PASS_MIN_DAYS=$(egrep ^PASS_MIN_DAYS ${FILEDEFS} | awk '{print $2}')
PASS_WARN_AGE=$(egrep ^PASS_WARN_AGE ${FILEDEFS} | awk '{print $2}')
PASS_MAX_DAYS=$(grep -E ^PASS_MAX_DAYS ${FILEDEFS} | awk '{print $2}')
PASS_MIN_DAYS=$(grep -E ^PASS_MIN_DAYS ${FILEDEFS} | awk '{print $2}')
PASS_WARN_AGE=$(grep -E ^PASS_WARN_AGE ${FILEDEFS} | awk '{print $2}')

if [[ ${RH_RELEASE} -gt 8 ]]; then
PASS_MIN_LEN=$(egrep ^minlen ${FILEQUAL} | cut -d "=" -f 2- | xargs echo)
PASS_MIN_LEN=$(grep -E ^minlen ${FILEQUAL} | cut -d "=" -f 2- | xargs echo)
else
PASS_MIN_LEN=$(egrep ^PASS_MIN_LEN ${FILEDEFS} | awk '{print $2}')
PASS_MIN_LEN=$(grep -E ^PASS_MIN_LEN ${FILEDEFS} | awk '{print $2}')
fi
flag=0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash

if parse_out=$(cat "/etc/redis.conf" | egrep "^bind +.*$"); then
if parse_out=$(cat "/etc/redis.conf" | grep -E "^bind +.*$"); then
redis_host=$(echo -n $parse_out | awk '{print $2}')
else
redis_host=127.0.0.1
fi

if parse_out=$(cat "/etc/redis.conf" | egrep "^port +.*$"); then
if parse_out=$(cat "/etc/redis.conf" | grep -E "^port +.*$"); then
redis_port=$(echo -n $parse_out | awk '{print $2}')
else
redis_port=6379
fi

if parse_out=$(cat "/etc/redis.conf" | egrep "^requirepass +.*$"); then
if parse_out=$(cat "/etc/redis.conf" | grep -E "^requirepass +.*$"); then
redis_pass=$(echo -n $parse_out | awk '{print $2}')
result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
else
Expand Down

0 comments on commit fcdab4d

Please sign in to comment.