From 0334d21ee02941dd0b5ede7f9e4ae48b9c1e75ca Mon Sep 17 00:00:00 2001 From: Christoph Johannes Kleine <linux@cj-k.de> Date: Sun, 3 Nov 2019 23:26:58 +0100 Subject: [PATCH] diskspreparation.sh: korrigiere bash Fehler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fehler "to many arguments" gelöst durch Anführungszeichen --- files/diskspreparation.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/files/diskspreparation.sh b/files/diskspreparation.sh index bf574a8..b4f9c63 100755 --- a/files/diskspreparation.sh +++ b/files/diskspreparation.sh @@ -22,7 +22,7 @@ convertSizeToByte() { local unit=$(echo $1 | sed "s/[0-9\.]*//g") local value=$(echo $1 | sed "s/[a-zA-Z%]*//g") local factor=1 - + case $(echo ${unit} | tr [A-Z] [a-z]) in "b") factor=1 ;; "kb") factor=1000 ;; @@ -37,7 +37,7 @@ convertSizeToByte() { esac res=$(dc -e "0k ${value} ${factor} * p") - + echo "${res%.*}" } @@ -77,7 +77,7 @@ validateScheme() { local lbl=$(echo ${diskdata[0]} | cut -f 6 -d ":") local retval=1 local scheme=$(eval echo \$DISK_$(echo $1 | tr [a-z] [A-Z])_SCHEME) - + if [ "x${scheme}" = "x${lbl}" ]; then retval=0 @@ -180,7 +180,7 @@ initialDiskPartitionLayout() { done } -# setDiskPartitionFlags - set the flags of a disk partitions +# setDiskPartitionFlags - set the flags of a disk partition # parameter: # $1 - disk device name # return: @@ -276,7 +276,7 @@ formatDiskPartitions() { done } -# generateFSTab - generate an fstab file +# generateFSTab - generate fstab file # parameter: # $1 - path of fstab file # $2 - mount path prefix (optional) @@ -313,12 +313,12 @@ generateFSTab() { dmp=$(echo ${part} | cut -f 5 -d ":") pass=$(echo ${part} | cut -f 6 -d ":") - if [ ${fs} = "swap" -o ${fs} = "linux-swap" ]; + if [ "${fs}" = "swap" -o "${fs}" = "linux-swap" ]; then mntpnt="none" fi - if [ -n ${fs} -a -n ${mntpnt} -a -n ${uuid} ]; + if [ -n "${fs}" -a -n "${mntpnt}" -a -n "${uuid}" ]; then echo "#/dev/${disk}${idx}" >>$1 if [ ${mntpnt} != "none" ]; @@ -343,7 +343,7 @@ do done validateScheme ${disk} - + if [ $? -eq 0 ]; then validateDiskPartitionLayout ${disk} -- GitLab