On Sat, 19 Jun 2021, Sven Schreiber wrote:
Hi,
below is a hansl function that checks whether shell calls are enabled,
by scanning the output of "set" for the line " shell_ok = 1".
<hansl>
function scalar checkshell(void)
string setbuf
outfile --buffer=setbuf
set
end outfile
strings setparts = strsplit(setbuf, "\n")
return nelem(instrings(setparts, " shell_ok = 1")) # mind the
leading blank!
end function
</hansl>
This could be generalized, but the whole thing strikes me as relatively
complicated. I have the feeling we discussed this before, but I don't
remember any details. What's the best way to query the currently active
set options programmatically?
? set shell_ok
shell_ok: boolean (on/off), currently on
But that's not programmatic of course. You do have the --to-file
option to "set". And I suppose we could offer a bundle of all set
variables as, say, $settings.
Allin