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

2016-05-20 Thread Laurent Bercot
On 20/05/2016 18:57, Max Ivanov wrote: Shell version of behaviour I am looking for (probably not portable, but nevertheless): ``` #!/bin/sh printf "%q " "$@" >/tmp/runme exec /bin/sh /tmp/runme ``` Your writer: redirfd -w 1 /tmp/runme dollarat -d "" Your reader+runner: redirfd -r 0 /tmp/r

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

2016-05-20 Thread Max Ivanov
> 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 $@ } execlineb /tmp/runme ``` Which I call like this: ``` /tmp/script strace -etrace=execve s6-echo A "

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

2016-05-20 Thread Laurent Bercot
On 20/05/2016 18:06, Max Ivanov wrote: Can't see how it can help, am I missing something? You're missing the -0 option, or the -d "" option. ;) -- Laurent

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

2016-05-20 Thread Max Ivanov
Can't see how it can help, am I missing something? Expected result is 2 arguments passed: ``` ./execlineb -c 'strace -etrace=execve ./s6-echo 1 "A B"' execve("./s6-echo", ["./s6-echo", "1", "A B"], [/* 102 vars */]) = 0 ``` What I actually get with dollarat: ``` echo "strace -etrace=execve ./s6-e

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

2016-05-20 Thread Laurent Bercot
How could I correctly save $@ in a file for a future execution? http://skarnet.org/software/execline/dollarat.html ? It won't work with the -S switch to execlineb though. -- Laurent

printf '%q ' "$@" alternative?

2016-05-20 Thread Max Ivanov
Hi All, How could I correctly save $@ in a file for a future execution?