On 2019-12-18, Andrei POPESCU wrote: > Attached patch fixes some issues reported by shellcheck
Thanks for the patch!
I will try and merge some of the changes...
> as well as make some minor optimizations (use bash code instead of
> external programs where this makes sense).
This is not bash code though, so the bashisms are not appropriate...
> diff --git a/u-boot-update b/u-boot-update
> index 2cfe3ca..2a25531 100755
> --- a/u-boot-update
> +++ b/u-boot-update
> @@ -103,10 +103,10 @@ EOF
> done < /etc/fstab
> fi
>
> -# if not in fsrab, try from current kernel arguments
> +# if not in fstab, try from current kernel arguments
> if [ -z "${U_BOOT_ROOT}" ]
> then
> - for param in `cat /proc/cmdline`
> + for param in $(< /proc/cmdline)
I'd probably prefer $(cat /proc/cmdline) ... just for clarity.
> @@ -176,7 +176,7 @@ do
> _FDT=""
> fi
>
> - if echo ${U_BOOT_ALTERNATIVES} | grep -q default
> + if [[ "${U_BOOT_ALTERNATIVES}" == *default* ]]
Requires bash.
> @@ -191,7 +191,7 @@ label l${_NUMBER}
>
> fi
>
> - if echo ${U_BOOT_ALTERNATIVES} | grep -q recovery
> + if [[ "${U_BOOT_ALTERNATIVES}" == *recovery* ]]
Also requires bash.
> @@ -202,12 +202,12 @@ label l${_NUMBER}r
> linux ${_BOOT_DIRECTORY}/${_KERNEL}
> ${_INITRD}
> ${_FDT}
> - append ${U_BOOT_ROOT} $(echo ${U_BOOT_PARAMETERS} | sed -e 's|
> quiet||') single
> + append ${U_BOOT_ROOT} ${U_BOOT_PARAMETERS# quiet} single
Will have to take another look at this one, but it sure *looks*
cleaner. :)
> - _NUMBER="$((${_NUMBER} + 1))"
> + _NUMBER="$((_NUMBER + 1))"
This looks like a typo? or maybe bash syntax?
live well,
vagrant
signature.asc
Description: PGP signature

