On 2022-12-05 11:58, Roman Perepelitsa wrote:
... and '$( ... )' is a fork? Yes, clearly by your example. Yeah, it spawns another shell, yes?Neither printf nor setopt are heavy. Forks are extremely inefficient though.
var=$(printf hello) printf -v var hello On my machine the first line is 1500 times slower than the second.
Holy cow, 1500 X ??I like efficiency in principle even if in practice it's miliseconds. But I have to keep appending to the list for each line, can the 'print -v var' method handle that? Not important, but it would be satisfying to do the whole thing in the current shell.