mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Remove basename(1). Clean up/shorten some coreutils pipelines
Basenames that remain, in cmd/zed/zed.d/statechange-led.sh:
dev=$(basename "$(echo "$therest" | awk '{print $(NF-1)}')")
vdev=$(basename "$ZEVENT_VDEV_PATH")
I don't wanna interfere with #11988
scripts/zfs-tests.sh:
SINGLETESTFILE=$(basename "$SINGLETEST")
tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib:
ACTUAL=$(basename $dataset)
ACTUAL=$(basename $dataset)
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/
zpool_iostat_-c_homedir.ksh:
typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL")
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/
zpool_iostat_-c_searchpath.ksh:
typeset CMD_1=$(basename "$SCRIPT_1")
typeset CMD_2=$(basename "$SCRIPT_2")
tests/zfs-tests/tests/functional/cli_user/zpool_status/
zpool_status_-c_homedir.ksh:
typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL")
tests/zfs-tests/tests/functional/cli_user/zpool_status/
zpool_status_-c_searchpath.ksh
typeset CMD_1=$(basename "$SCRIPT_1")
typeset CMD_2=$(basename "$SCRIPT_2")
tests/zfs-tests/tests/functional/migration/migration.cfg:
export BNAME=`basename $TESTFILE`
tests/zfs-tests/tests/perf/perf.shlib:
typeset logbase="$(get_perf_output_dir)/$(basename \
tests/zfs-tests/tests/perf/perf.shlib:
typeset logbase="$(get_perf_output_dir)/$(basename \
These are potentially Of Directories, where basename is actually
useful
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12652
This commit is contained in:
@@ -57,8 +57,7 @@ find_pools()
|
||||
local pools
|
||||
|
||||
pools=$("$@" 2> /dev/null | \
|
||||
grep -E "pool:|^[a-zA-Z0-9]" | \
|
||||
sed 's@.*: @@' | \
|
||||
sed -Ee '/pool:|^[a-zA-Z0-9]/!d' -e 's@.*: @@' | \
|
||||
sort | \
|
||||
tr '\n' ';')
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ read_mtab()
|
||||
|
||||
# Unset all MTAB_* variables
|
||||
# shellcheck disable=SC2046
|
||||
unset $(env | grep ^MTAB_ | sed 's,=.*,,')
|
||||
unset $(env | sed -e '/^MTAB_/!d' -e 's,=.*,,')
|
||||
|
||||
while read -r fs mntpnt fstype opts rest; do
|
||||
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
|
||||
@@ -363,9 +363,8 @@ read_mtab()
|
||||
fs=$(/bin/echo "$fs" | sed 's,\\0,\\00,')
|
||||
|
||||
# Remove 'unwanted' characters.
|
||||
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
|
||||
-e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
|
||||
fs=$(printf '%b\n' "$fs")
|
||||
mntpnt=$(printf '%b' "$mntpnt" | tr -d '/. -')
|
||||
fs=$(printf '%b' "$fs")
|
||||
|
||||
# Set the variable.
|
||||
eval export "MTAB_$mntpnt=\"$fs\""
|
||||
@@ -377,8 +376,7 @@ in_mtab()
|
||||
{
|
||||
local mntpnt="$1"
|
||||
# Remove 'unwanted' characters.
|
||||
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
|
||||
-e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
|
||||
mntpnt=$(printf '%b' "$mntpnt" | tr -d '/. -')
|
||||
local var
|
||||
|
||||
var="$(eval echo "MTAB_$mntpnt")"
|
||||
@@ -394,7 +392,7 @@ read_fstab()
|
||||
|
||||
# Unset all FSTAB_* variables
|
||||
# shellcheck disable=SC2046
|
||||
unset $(env | grep ^FSTAB_ | sed 's,=.*,,')
|
||||
unset $(env | sed -e '/^FSTAB_/!d' -e 's,=.*,,')
|
||||
|
||||
i=0
|
||||
while read -r fs mntpnt fstype opts; do
|
||||
@@ -404,7 +402,7 @@ read_fstab()
|
||||
|
||||
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
|
||||
eval export "FSTAB_dev_$i=$fs"
|
||||
fs=$(printf '%b\n' "$fs" | sed 's,/,_,g')
|
||||
fs=$(printf '%b' "$fs" | tr '/' '_')
|
||||
eval export "FSTAB_$i=$mntpnt"
|
||||
|
||||
i=$((i + 1))
|
||||
|
||||
Reference in New Issue
Block a user