On Sun, Jan 07, 2024 at 07:28:12PM +0000, Michael Kjörling wrote: > On 7 Jan 2024 14:20 -0500, from [email protected] (Greg Wooledge): > >> #!/bin/sed -e 1d > > > > This is not a valid shebang. You're only permitted ONE argument after > > the interpreter name. You're going to execute /bin/sed '-e 1d' 'filename' > > with this. > > Okay, fair point. In my defense, I tried it and it worked.
unicorn:~$ seq 5 | sed '-e 1d' 2 3 4 5 Hmm... my first thought was that GNU sed is being lenient here, but on further reflection I'm not sure about that. This is equivalent to sed -e ' 1d' (with a leading space in front of the script which is the option-argument of -e). And perhaps sed permits leading whitespace in each line of its scripts, for purposes of readability. In any case, trying to put multiple arguments on the shebang won't work in general. It's a well-known behavior, and is why GNU env(1) has -S.

