• Re: config files - newline possible?

    From Nicolas George@21:1/5 to All on Thu Apr 11 18:00:01 2024
    Hans (12024-04-11):
    But can this be done in config-files, too?

    Depends entirely on the software reading the config file. Some will use
    \, some will use something else, some will offer no solution.

    Regards,

    --
    Nicolas George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Thu Apr 11 18:00:01 2024
    Hi folks,

    O know in shell scripts it is possible, to seperate a looong line of commands into several short lines.

    But can this be done in config-files, too?

    I have a files with the syntax like this:

    Do_not_write="/path1/subfolder /path1/subfolder2 ... /pathX/subfolderX"

    And as there are many paths, the line is very long.

    Is there aay, to make one line to several lines?

    In bash (I believe), it is a backslash sign, which leads to the next line, but does this also work in configuration files?

    Thanks for enlightening me.

    Best

    Hans

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Hans on Thu Apr 11 20:30:01 2024
    On Thu, Apr 11, 2024 at 05:56:05PM +0200, Hans wrote:
    Hi folks,

    O know in shell scripts it is possible, to seperate a looong line of commands
    into several short lines.

    But can this be done in config-files, too?

    I have a files with the syntax like this:

    Do_not_write="/path1/subfolder /path1/subfolder2 ... /pathX/subfolderX"

    As Nicolas George says, "config-file" is too generic a term.
    If the above is a variable assignment, then you can escape the
    newlines with a backslash, like so

    Do_not_write="path1/subfolder \
    path1/subfolder2 \
    ..."

    Note that the backslash has to be the last character in the
    line. No extra whitespace after that (this is somewhat
    fragile). I prefer to put such things in here docs:

    read -d '' Do_not_write <<"__END"
    this
    that
    the other
    __END

    echo "Do_not_write"

    this
    that
    the other

    Put attention to the quotes. In bash, type "help read" to learn
    about the options (it is a builtin, it has to).

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZhgquwAKCRAFyCz1etHa RuCBAJ418uS1p0/sA5pUmK/wPJeLlNJcbACeJ5x0dF3w/vgryHQjoNkyxAuNuk4=
    =dPm2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Hans on Thu Apr 11 20:50:01 2024
    On Thu, Apr 11, 2024 at 08:42:20PM +0200, Hans wrote:
    in my case it is the config freom from bootcdwrite, which is bootcdwrite.conf.

    <https://manpages.debian.org/bookworm/bootcd/bootcdwrite.conf.5.en.html>
    says:

    This file will be sourced as shell file.

    So, you may use any valid "shell" (presumably sh) syntax, including backslash-newline for continuation.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans@21:1/5 to All on Thu Apr 11 20:50:01 2024
    Hi Tomas,

    in my case it is the config freom from bootcdwrite, which is bootcdwrite.conf.

    The parm is NOT_TO_CD and as there are many and partly long pathnames, the
    line has increased rather long. So I want to shorten it.

    But as it was said: there is no general way for this. So I just try some
    things out for this, and the next time again.

    Thought I have something missed, but does not look so.

    Thanks for all the help, I think this case caqn be closed. I will wait for one or two days and then mark this case as closed.

    Cheers

    Hans

    As Nicolas George says, "config-file" is too generic a term.
    If the above is a variable assignment, then you can escape the
    newlines with a backslash, like so

    Do_not_write="path1/subfolder \
    path1/subfolder2 \
    ..."

    Note that the backslash has to be the last character in the
    line. No extra whitespace after that (this is somewhat
    fragile). I prefer to put such things in here docs:

    read -d '' Do_not_write <<"__END"
    this
    that
    the other
    __END

    echo "Do_not_write"

    this
    that
    the other

    Put attention to the quotes. In bash, type "help read" to learn
    about the options (it is a builtin, it has to).

    Cheers

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)