3 ms·
What shell are you using? I could see a naive shell forking twice without exec, but I don't know of a shell that does that. Exec just says "don't fork(3) befo
by LukeShu 10y ago
What shell are you using? I could see a naive shell forking twice without exec, but I don't know of a shell that does that. Exec just says "don't fork(3) before calling exec(3)", but, but inside of a pipeline like that, it shouldn't fork again anyway. I have tried it with and without.
- _c_ 10y agoIn theory it should not make a difference but my scripts seem to run faster when I use exec after pipe. Normally I would only add exec to the last command in the script, as djb does. But then I started experimenting with using it after pipes. If you or anyone can explain why this could make scripts "seem" to execute faster, I would be grateful. Here's the shell source: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-release-7/src/bin/sh Incidentally, have you ever tried execlineb? I use that sometimes too.