From 0d4248588815e89f6e4c3a944dfdeb0f765b5575 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Wed, 3 Nov 2021 15:34:17 +0800 Subject: [PATCH] mkdumprd: remove some redundant echo upstream: fedora resolves: bz2003832 conflict: none commit e4c7b5bbf598be896ae6aeb7b842a15b4be63d38 Author: Kairui Song Date: Wed Aug 4 03:53:35 2021 +0800 mkdumprd: remove some redundant echo Signed-off-by: Kairui Song Acked-by: Philipp Rudo Signed-off-by: Tao Liu --- mkdumprd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mkdumprd b/mkdumprd index b866a9b..d062a91 100644 --- a/mkdumprd +++ b/mkdumprd @@ -94,7 +94,7 @@ to_mount() { #$1=dump target #called from while loop and shouldn't read from stdin, so we're using "ssh -n" get_ssh_size() { - local _opt _out _size + local _opt _out _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes" _out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH") [ $? -ne 0 ] && { @@ -102,8 +102,7 @@ get_ssh_size() { } #ssh output removed the line break, so print field NF-2 - _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}') - echo -n $_size + echo -n "$_out" | awk '{avail=NF-2; print $avail}' } #mkdir if save path does not exist on ssh dump target @@ -134,14 +133,13 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() { - local _mnt=$(get_mntpoint_from_target $1) - echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}') + df -P "$(get_mntpoint_from_target "$1")/$SAVE_PATH"|tail -1|awk '{print $4}' } #Function: get_raw_size #$1=dump target get_raw_size() { - echo -n $(fdisk -s "$1") + fdisk -s "$1" } #Function: check_size