Re: printf '%q ' "$_at_" alternative?

From: Max Ivanov <ivanov.maxim_at_gmail.com>
Date: Fri, 20 May 2016 17:57:03 +0100

> You're missing the -0 option, or the -d "" option. ;)

Can't wrap my head around it, calling for help.

So I have a /tmp/script:

```
#!/bin/execlineb -S0
if { redirfd -w 1 /tmp/runme s6-echo $_at_ }
execlineb /tmp/runme
```

Which I call like this:
```
/tmp/script strace -etrace=execve s6-echo A "B C"
```

And it produces incorrect result (3 args are passed, not 2).

How /tmp/script can be modified so it handles non-trivial case correctly?


Shell version of behaviour I am looking for (probably not portable,
but nevertheless):

```
#!/bin/sh
printf "%q " "$_at_" >/tmp/runme
exec /bin/sh /tmp/runme
```
Received on Fri May 20 2016 - 16:57:03 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC