Re: shell scripts, spaces, and backslashes

2024-10-12 Thread Chet Ramey
On 10/11/24 3:41 PM, Bruno Haible wrote: Hi Chet, Hi, Bruno. I wrote: Stackoverflow [1] says that word-expansion must be avoided, because it does not support the spaces in arguments These two examples show how non-intuitive shell scripts behave, regarding spaces and backslashes in argumen

Re: shell scripts, spaces, and backslashes

2024-10-11 Thread Bruno Haible via Gnulib discussion list
Hi Chet, > > I wrote: > >> Stackoverflow [1] says that word-expansion must be > >> avoided, because it does not support the spaces in arguments > > > > These two examples show how non-intuitive shell scripts behave, > > regarding spaces and backslashes in arguments: > > > > $ printf '%s\n' a\\bc

Re: shell scripts, spaces, and backslashes

2024-10-11 Thread Chet Ramey
On 10/11/24 4:54 AM, Bruno Haible via Gnulib discussion list wrote: I wrote: Stackoverflow [1] says that word-expansion must be avoided, because it does not support the spaces in arguments These two examples show how non-intuitive shell scripts behave, regarding spaces and backslashes in argum

Re: shell scripts, spaces, and backslashes

2024-10-11 Thread Michele Locati
Il giorno ven 11 ott 2024 alle ore 11:00 Michele Locati ha scritto: > > > $ var='a\\bc\ d\\ef' > > $ printf '%s\n' $var > > a\\bc\ > > d\\ef > > And also: > > $ printf '%s\n' $var > a\\bc\ d\\ef Sorry, I meant printf '%s\n' "$var" a\\bc\ d\\ef

Re: shell scripts, spaces, and backslashes

2024-10-11 Thread Michele Locati
> $ var='a\\bc\ d\\ef' > $ printf '%s\n' $var > a\\bc\ > d\\ef And also: $ printf '%s\n' $var a\\bc\ d\\ef > Good luck understanding this! :D

shell scripts, spaces, and backslashes

2024-10-11 Thread Bruno Haible via Gnulib discussion list
I wrote: > Stackoverflow [1] says that word-expansion must be > avoided, because it does not support the spaces in arguments These two examples show how non-intuitive shell scripts behave, regarding spaces and backslashes in arguments: $ printf '%s\n' a\\bc\ d\\ef a\bc d\ef $ var='a\\bc\ d\\ef'