On 1 Nov 2021, at 14:26, Pablo Rodriguez via ntg-context
wrote: Dear list,
is there a way if a program is installed on the computer using Lua.
I have the following sample:
\starttext \startluacode filename = tex.jobname .. ".pdf" os.exec("dir " .. filename) \stopluacode \stoptext
Is there a way to wrap os.exec() in the sample so that it only runs if "dir" is available?
if os.which(‘dir’) then ... end But note that os.which() may be unreliable in various cases (like it will fail for shell/command interpreter builtins, in cron jobs, in special scripted environments, and may incorrectly succeed for disabled/forbidden commands), as it just runs through the PATH environment variable to check for executable file existence. Often times, it is better to just try to run the command to see if that produces satisfactory results. Best wishes, taco — Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)