:: Re: [DNG] vdev status update in dae…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: aitor
Datum:  
To: Olaf Meeuwissen
CC: dng
Betreff: Re: [DNG] vdev status update in daedalus
Hi Olaf, and sorry for my delay

On 10/12/23 13:16, Olaf Meeuwissen wrote:
> Based on the above code and assuming /bin/sh as your interpreter, it
> looks like you wanted to use shell globs. In that case you can remove
> the dependency on egrep (aka grep -E) with
>
>    case "$VDEV_PATH" in
>      fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*|zram*|mmcblk[0-9]*rpmb) return 0;;
>    esac

>
> As a matter of style, you may want to add a default action before the
> esac like
>
>      *) : ;;
>    esac


I agree with you. This is a good idea. Btw, the interpreter is
/bin/dash, a simplistic modern POSIX compliant version of /bin/sh, and
the script was written by Jude Nelson. But years ago, of course.

> If you continue using grep, I would also remove the hard-coded path. If
> you have concerns about the PATH value in your script, set that instead.
> That is, use something like
>
>    PATH=/sbin:/bin:/usr/sbin:/usr/bin

>
> to make sure you get the system's grep.
>
> BTW, according to the upstream NEWS file, /usr/share/doc/grep/NEWS.gz,
> egrep (and fgrep) have been deprecated in 2.5.3 (2007) and marked
> obsolescent in 3.8 (2022-09-02). Based on that, replace egrep with
> `grep -E` sooner rather than later.
>
> The -E option signals*extended* regular expressions. These differ from
> shell globs in ways which seem to have tripped you up in disk.sh. Check
> the grep manual page for the details.
>
> Hope this helps,


Thank you very much for your suggestions. I'll work on these scripts over the course of the week.

Cheers,

Aitor.