Skip to main content

which

function

babashka.fs/which

(which [program] [program opts])
Returns `Path` to first executable `program` found in `:paths` `opt`, similar to the `which` Unix command. Default for `:paths` is ([[exec-paths]]). On Windows, searches for `program` with filename extensions specified in `:win-exts` option. Default is `["com" "exe" "bat" "cmd"]`. If `program` already includes an extension from `:win-exts`, it will be searched as-is first. When `program` is a relative or absolute path, `:paths` option is not consulted. On Windows, the `:win-exts` variants are still searched. On other OSes, the path for `program` will be returned if executable, else `nil`.

No examples yet. Be the first to add one!