Re: create-sbu_du-report.sh empty var
| Newsgroups | gmane.linux.lfs.automated |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2022-02-18 at 22:37 +0100, Thomas Seeling wrote:
> Hallo Pierre,
>
> > I guess it is better to check a posteriori whether J_VALUE has a value...
> > Can you test that the change in commit 0f3b1c3 fixes your issue please?
>
> testing J_VALUE after running the sed commands is not useful, it still
> complains about "unary operator expected".
>
> If the config/report file does not contain either keyword the if is
> still empty on the left-hand side of the comparison.
Yes you are right. It would be simpler to use outside double quotes in the left-
hand side, but I'm not sure it is possible because of the inner double quotes.
Let me try...
>
> Legis arte would be checking if either keyword is present and only in
> this case enter the if clause, and if neither keyword is present use a
> default value of 1.
>
> if egrep -q "N_PARALLEL|REALSBU" "${REPORT}"
> then
> if [ $(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT") = y ]; then
> J_VALUE="1"
> else
> J_VALUE=$(sed -n '/N_PARALLEL/s/.*<\([^>]*\).*/\1/p' "$REPORT")
> fi
> else
> J_VALUE="${J_VALUE:-1}"
> fi
>
Yes that should work too. Thanks
Pierre
--
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page