[arch-projects] [initscripts] Incorrect environment variable checks in sysinit & co?

Rémy Oudompheng remyoudompheng at gmail.com
Thu Mar 31 19:35:18 EDT 2011


On 2011/4/1 Dave Reisner <d at falconindy.com> wrote:
> 1) Word split /proc/cmdline into an array and use in_array from
> /etc/rc.d/functions:
>
> kern_cmdline=($(< /proc/cmdline))
> if in_array "${kern_cmdline[@]}" verbose; then
>  ...
>
> 2) Word split /proc/cmdline with printf and use grep -x:
>
> if printf "%s\n" $(</proc/cmdline) | grep x 'verbose'; then
>  ...
>

These look very strange. I would be more tempted to inline the in_array and say:

/bin/dmesg -n 3
for cmdlinearg
do
    [[ $cmdlinearg == "verbose" ]] && /bin/dmesg -n 8
done

which seems more readable and less magical to me.

Rémy.


More information about the arch-projects mailing list