egrep -> grep -E

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13259
This commit is contained in:
наб
2022-03-12 00:25:47 +01:00
committed by Brian Behlendorf
parent 270d0a5a16
commit f63c9dc70a
18 changed files with 48 additions and 75 deletions
+16 -26
View File
@@ -115,21 +115,18 @@ function is_physical_device #device
if is_linux; then
is_disk_device "$DEV_DSKDIR/$device" && \
[[ -f /sys/module/loop/parameters/max_part ]]
return $?
[ -f /sys/module/loop/parameters/max_part ]
elif is_freebsd; then
is_disk_device "$DEV_DSKDIR/$device" && \
echo $device | egrep -q \
echo $device | grep -qE \
-e '^a?da[0-9]+$' \
-e '^md[0-9]+$' \
-e '^mfid[0-9]+$' \
-e '^nda[0-9]+$' \
-e '^nvd[0-9]+$' \
-e '^vtbd[0-9]+$'
return $?
else
echo $device | egrep "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1
return $?
echo $device | grep -qE "^c[0-F]+([td][0-F]+)+$"
fi
}
@@ -143,8 +140,7 @@ function is_real_device #disk
if is_linux; then
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
egrep disk >/dev/null
return $?
grep -q disk
fi
}
@@ -158,8 +154,7 @@ function is_loop_device #disk
if is_linux; then
lsblk $DEV_RDSKDIR/$disk -o TYPE 2>/dev/null | \
egrep loop >/dev/null
return $?
grep -q loop
fi
}
@@ -182,7 +177,7 @@ function is_mpath_device #disk
if is_linux; then
lsblk $DEV_MPATHDIR/$disk -o TYPE 2>/dev/null | \
egrep mpath >/dev/null
grep -q mpath
if (($? == 0)); then
readlink $DEV_MPATHDIR/$disk > /dev/null 2>&1
return $?
@@ -333,14 +328,14 @@ function on_off_disk # disk state{online,offline} host
dep="$(ls /sys/block/${dm_name}/slaves | awk '{print $1}')"
while [[ -n $dep ]]; do
#check if disk is online
if lsscsi | egrep -q $dep; then
if lsscsi | grep -qF $dep; then
dep_dir="/sys/block/${dm_name}"
dep_dir+="/slaves/${dep}/device"
ss="${dep_dir}/state"
sd="${dep_dir}/delete"
log_must eval "echo 'offline' > ${ss}"
log_must eval "echo '1' > ${sd}"
if lsscsi | egrep -q $dep; then
if lsscsi | grep -qF $dep; then
log_fail "Offlining $disk failed"
fi
fi
@@ -348,17 +343,14 @@ function on_off_disk # disk state{online,offline} host
done
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
#check if disk is online
lsscsi | egrep $disk > /dev/null
if (($? == 0)); then
if lsscsi | grep -qF $disk; then
dev_state="/sys/block/$disk/device/state"
dev_delete="/sys/block/$disk/device/delete"
log_must eval "echo 'offline' > ${dev_state}"
log_must eval "echo '1' > ${dev_delete}"
lsscsi | egrep $disk > /dev/null
if (($? == 0)); then
log_fail "Offlining $disk" \
"failed"
fi
if lsscsi | grep -qF $disk; then
log_fail "Offlining $disk failed"
fi
else
log_note "$disk is already offline"
fi
@@ -369,13 +361,13 @@ function on_off_disk # disk state{online,offline} host
if is_mpath_device $disk; then
dm_name="$(readlink $DEV_DSKDIR/$disk | cut -d/ -f2)"
dep="$(ls /sys/block/$dm_name/slaves | awk '{print $1}')"
if lsscsi | egrep -q $dep; then
if lsscsi | grep -qF $dep; then
log_fail "Onlining $disk failed"
fi
elif is_real_device $disk; then
block_device_wait
typeset -i retries=0
while ! lsscsi | egrep -q $disk; do
while ! lsscsi | grep -qF $disk; do
if (( $retries > 2 )); then
log_fail "Onlining $disk failed"
break
@@ -451,16 +443,14 @@ function load_scsi_debug # dev_size_mb add_host num_tgts max_luns blksz
log_unsupported "Platform does not have scsi_debug"
"module"
fi
lsmod | egrep scsi_debug > /dev/null
if (($? == 0)); then
if lsmod | grep -q scsi_debug; then
log_fail "scsi_debug module already installed"
else
log_must modprobe scsi_debug dev_size_mb=$devsize \
add_host=$hosts num_tgts=$tgts max_luns=$luns \
sector_size=$sector physblk_exp=$blkexp
block_device_wait
lsscsi | egrep scsi_debug > /dev/null
if (($? == 1)); then
if ! lsscsi | grep -q scsi_debug; then
log_fail "scsi_debug module install failed"
fi
fi
-1
View File
@@ -32,7 +32,6 @@ export SYSTEM_FILES_COMMON='arp
dmesg
du
echo
egrep
env
expr
false
+3 -3
View File
@@ -2018,8 +2018,8 @@ function verify_pool
#
function get_disklist # pool
{
zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
egrep -v -e '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$"
echo $(zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
grep -vEe '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
}
#
@@ -2182,7 +2182,7 @@ function check_pool_status # pool token keyword <verbose>
if [[ $verbose == true ]]; then
log_note $scan
fi
echo $scan | egrep -qi "$keyword"
echo $scan | grep -qi "$keyword"
}
#