On Sun, 2022-12-25 at 02:29 +0100, Giangiacomo Zaffini wrote: > I cannot see where > sed -e "s/$/ \\/" > can be wrong on Windows command line or Windows PowerShell.
It's because, apparently, cmd.exe sees the "\\" and turns it into a single "\" before it invokes the command. Then the syntax is: sed -e 's/$/ \/' which is not legal because the backslash escapes the trailing slash, and now there's no trailing slash for the s/// operator. So you get an error. If I'm in cmd.exe and I use Perl to show how cmd.exe will interpret the command line (using Perl because I know it will be installed if someone is running the GNU make test suite; you could use something else if you like): C:\Users\user> perl -e "print $ARGV[0];" "s/$/ \\/" s/$/ \/ note how there's only one "\" here which is wrong and gives an error when passed to sed (at least, my version of sed). On the other hand if I run this: C:\Users\user> perl -e "print $ARGV[0];" "s/$/ \\\/" s/$/ \\/ now see how the "\" is escaped, as it should be, and now sed would be happy with this. > On the other hand, as reported, it is true that original sed command > is correct on MSYS/mingw64/mingw32 I don't understand what you mean here. MSYS/mingw64/mingw32 is not a command interpreter, it's a subsystem description. > gzaff@LAPTOP-6HAJ0RG0 MSYS /c/Users/gzaff/Devs/make > $ echo static const char *const GUILE_module_defn = \" \\> src/gmk- > default.h This is a POSIX shell, it's irrelevant what the behavior is in a POSIX shell since we're working with a cmd.exe batch file (bootstrap.bat). > I don't know, maybe understanding if bootstrap.bat is running under > MSYS2/mingw64/mingw32 bash > or > Windows command line/Windows PowerShell > and use correct sed syntax for the case ? Again I didn't understand this, sorry. How can we run a .bat file "under bash"? Bash is a POSIX shell: it can't interpret a .bat file. If you have a POSIX shell, you should be running "bootstrap" which is a shell script, not "bootstrap.bat" which is a batch file.