Liste des Groupes | Revenir à cu programmer |
On Sat, 31 Aug 2024 09:27:44 +0100, Richard Kettlewell wrote:If one wants to cope with any character (including newline characters) in the POSIX shell's command line, one could make use of the apostroph quoting mechanism. If one wants to process arbitrary (may be generated) lists of filenames, one could make use of the "xargs" utility with option "-0". To generate those lists of filenames, there are find ... -print0
>I think the thing that makes it hard is not the spaces as such, but the tooling that makes it inconvenient to handle them, which primarily means Bourne shell parsing rules. The problem basically ceases to exist once you’re outside the shell ecosystem. >>
>
The rest of Unix has evolved substantially since the 1970s but shell is still stuck in this particular trap. It’s like we’re still making making arrowheads out of flint but everything else from steel. >
If you avoid newlines in filenames, Posix shells can cope with anything else if you set “IFS=$'\n'”. >
>
If you insist on wanting to accept those as well, then I don’t think Posix is enough, but Bash does have facilities that help you cope. >
Les messages affichés proviennent d'usenet.