Fix shellcheck v0.4.6 warnings
Resolve new warnings reported after upgrading to shellcheck version 0.4.6. This patch contains no functional changes. * egrep is non-standard and deprecated. Use grep -E instead. [SC2196] * Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. [SC2181] Suppressed. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #7040
This commit is contained in:
parent
2a7b736dce
commit
9d1a39cec6
|
@ -397,7 +397,7 @@ zed_rate_limit()
|
|||
|
||||
zed_lock "${lockfile}" "${lockfile_fd}"
|
||||
time_now="$(date +%s)"
|
||||
time_prev="$(egrep "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
|
||||
time_prev="$(grep -E "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
|
||||
| tail -1 | cut -d\; -f1)"
|
||||
|
||||
if [ -n "${time_prev}" ] \
|
||||
|
@ -406,7 +406,7 @@ zed_rate_limit()
|
|||
else
|
||||
umask_bak="$(umask)"
|
||||
umask 077
|
||||
egrep -v "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
|
||||
grep -E -v "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
|
||||
> "${statefile}.$$"
|
||||
echo "${time_now};${tag}" >> "${statefile}.$$"
|
||||
mv -f "${statefile}.$$" "${statefile}"
|
||||
|
|
|
@ -19,7 +19,7 @@ function test_url()
|
|||
function check_tagged_line()
|
||||
{
|
||||
regex='^\s*'"$1"':\s[[:print:]]+\s<[[:graph:]]+>$'
|
||||
foundline=$(git log -n 1 "$REF" | egrep -m 1 "$regex")
|
||||
foundline=$(git log -n 1 "$REF" | grep -E -m 1 "$regex")
|
||||
if [ -z "$foundline" ]; then
|
||||
echo "error: missing \"$1\""
|
||||
return 1
|
||||
|
@ -51,7 +51,7 @@ function new_change_commit()
|
|||
error=0
|
||||
|
||||
# subject is not longer than 50 characters
|
||||
long_subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '.{51}')
|
||||
long_subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{51}')
|
||||
if [ -n "$long_subject" ]; then
|
||||
echo "error: commit subject over 50 characters"
|
||||
error=1
|
||||
|
@ -63,7 +63,7 @@ function new_change_commit()
|
|||
fi
|
||||
|
||||
# ensure that no lines in the body of the commit are over 72 characters
|
||||
body=$(git log -n 1 --pretty=%b "$REF" | egrep -m 1 '.{73}')
|
||||
body=$(git log -n 1 --pretty=%b "$REF" | grep -E -m 1 '.{73}')
|
||||
if [ -n "$body" ]; then
|
||||
echo "error: commit message body contains line over 72 characters"
|
||||
error=1
|
||||
|
@ -75,7 +75,7 @@ function new_change_commit()
|
|||
function is_openzfs_port()
|
||||
{
|
||||
# subject starts with OpenZFS means it's an openzfs port
|
||||
subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS')
|
||||
subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^OpenZFS')
|
||||
if [ -n "$subject" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
@ -86,7 +86,7 @@ function is_openzfs_port()
|
|||
function openzfs_port_commit()
|
||||
{
|
||||
# subject starts with OpenZFS dddd
|
||||
subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS [[:digit:]]+ - ')
|
||||
subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^OpenZFS [[:digit:]]+ - ')
|
||||
if [ -z "$subject" ]; then
|
||||
echo "OpenZFS patch ports must have a summary that starts with \"OpenZFS dddd - \""
|
||||
error=1
|
||||
|
|
|
@ -70,12 +70,12 @@ function or_die
|
|||
|
||||
# core file helpers
|
||||
origcorepattern="$(cat /proc/sys/kernel/core_pattern)"
|
||||
coreglob="$(egrep -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
|
||||
coreglob="$(grep -E -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
|
||||
|
||||
if [[ $coreglob = "*" ]]; then
|
||||
echo "Setting core file pattern..."
|
||||
echo "core" > /proc/sys/kernel/core_pattern
|
||||
coreglob="$(egrep -o '^([^|%[:space:]]*)' \
|
||||
coreglob="$(grep -E -o '^([^|%[:space:]]*)' \
|
||||
/proc/sys/kernel/core_pattern)*"
|
||||
fi
|
||||
|
||||
|
@ -235,7 +235,7 @@ while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do
|
|||
echo "$desc" >>ztest.out
|
||||
$cmd >>ztest.out 2>&1
|
||||
ztrc=$?
|
||||
egrep '===|WARNING' ztest.out >>ztest.history
|
||||
grep -E '===|WARNING' ztest.out >>ztest.history
|
||||
$ZDB -U "$workdir/zpool.cache" -DD ztest >>ztest.ddt
|
||||
|
||||
store_core
|
||||
|
|
|
@ -410,7 +410,7 @@ function get_xattr #<obj>
|
|||
fi
|
||||
|
||||
for xattr in `runat $obj ls | \
|
||||
/usr/xpg4/bin/egrep -v -e SUNWattr_ro -e SUNWattr_rw` ; do
|
||||
grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do
|
||||
runat $obj sum $xattr
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue