On 2025-06-15, Laurent Bercot wrote:

It works for me.
When in doubt, to debug an execline script, use strace.
What does "strace -vf -e execve,fork,clone -- yourscript" show?

Attached, it exits on eltest "l1" = "l2".

Execline 2.9.7.0 built on Linux against musl 1.2.5 and skalibs 2.14.4.0
with:
CPPFLAGS='-nostdinc -isystem /usr/lib/musl/include -isystem /usr/include'
CC="musl-gcc"
./configure --enable-static-libc --enable-pedantic-posix --enable-multicall \
  --prefix=/usr --libdir=/usr/lib/execline
execve("./t1", ["./t1"], ["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace"]) = 0
execve("/usr/bin/forbacktickx", ["forbacktickx", "-x", "0", "-E", "line", " 
printf", " l1\nl2\nl3\nl2\n", "", "if", " eltest", " ${line}", " =", " l2", "", 
"printf", "${line}\n"], ["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", 
"0=./t1"]) = 0
execve("/usr/bin/pipeline", ["pipeline", "--", " printf", " l1\nl2\nl3\nl2\n", 
"", "unexport", "!", "forstdin", "-E", "-n", "-x", "0", "--", "line", "fdmove", 
"0", "3", "if", " eltest", " ${line}", " =", " l2", "", "printf", "${line}\n"], 
["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", "0=./t1"]) = 0
clone(child_stack=0xffffc68b22a0, flags=CLONE_VM|CLONE_VFORK|SIGCHLDstrace: 
Process 922718 attached
 <unfinished ...>
[pid 922718] execve("/usr/bin/printf", ["printf", "l1\nl2\nl3\nl2\n"], 
["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", "0=./t1"] <unfinished 
...>
[pid 922717] <... clone resumed>)       = 922718
[pid 922718] <... execve resumed>)      = 0
[pid 922717] execve("/usr/bin/unexport", ["unexport", "!", "forstdin", "-E", 
"-n", "-x", "0", "--", "line", "fdmove", "0", "3", "if", " eltest", " ${line}", 
" =", " l2", "", "printf", "${line}\n"], ["PWD=/dev/shm", "SHLVL=1", 
"_=/usr/bin/strace", "#=0", "0=./t1", "!=922718"]) = 0
[pid 922717] execve("/usr/bin/forstdin", ["forstdin", "-E", "-n", "-x", "0", 
"--", "line", "fdmove", "0", "3", "if", " eltest", " ${line}", " =", " l2", "", 
"printf", "${line}\n"], ["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", 
"0=./t1"]) = 0
[pid 922717] clone(child_stack=0xffffd9332af0, 
flags=CLONE_VM|CLONE_VFORK|SIGCHLDstrace: Process 922719 attached
 <unfinished ...>
[pid 922718] +++ exited with 0 +++
[pid 922719] execve("/usr/bin/importas", ["importas", "-uSi", "--", "line", 
"fdmove", "0", "3", "if", " eltest", " ${line}", " =", " l2", "", "printf", 
"${line}\n"], ["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", "0=./t1", 
"line=l1"] <unfinished ...>
[pid 922717] <... clone resumed>)       = 922719
[pid 922719] <... execve resumed>)      = 0
[pid 922717] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=922718, 
si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 922719] execve("/usr/bin/fdmove", ["fdmove", "0", "3", "if", " eltest", " 
l1", " =", " l2", "", "printf", "l1\n"], ["PWD=/dev/shm", "SHLVL=1", 
"_=/usr/bin/strace", "#=0", "0=./t1"] <unfinished ...>
[pid 922717] +++ exited with 0 +++
<... execve resumed>)                   = 0
execve("/usr/bin/if", ["if", " eltest", " l1", " =", " l2", "", "printf", 
"l1\n"], ["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", "0=./t1"]) = 0
clone(child_stack=0xffffdbfa5810, flags=CLONE_VM|CLONE_VFORK|SIGCHLDstrace: 
Process 922720 attached
 <unfinished ...>
[pid 922720] execve("/usr/bin/eltest", ["eltest", "l1", "=", "l2"], 
["PWD=/dev/shm", "SHLVL=1", "_=/usr/bin/strace", "#=0", "0=./t1"] <unfinished 
...>
[pid 922719] <... clone resumed>)       = 922720
[pid 922720] <... execve resumed>)      = 0
[pid 922720] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=922720, si_uid=1000, 
si_status=1, si_utime=0, si_stime=0} ---
+++ exited with 1 +++

Reply via email to