← All procedures

shell.which

Find the path to a command

CLI
Package
@procedures/shell · README
Path
["shell","which"]
CLI
mark shell which --command <string>
As data
{"$proc":["shell","which"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/shell"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["shell","which"], { command: "<command>" });
console.log(JSON.stringify(result));

From the command line

$ mark shell which --command <string>

As data, in a program

{ "$proc": ["shell", "which"], "input": { "command": "<command>" } }

Input

FieldTypeRequiredDefaultDescription
commandstringyesCommand to find

Output

FieldTypeRequiredDefaultDescription
pathstring | nullyesThe full path of the program, or null when it is not found
foundbooleanyesTrue when the program is found
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "command": {
        "type": "string",
        "description": "Command to find"
      }
    },
    "required": [
      "command"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "description": "The full path of the program, or null when it is not found",
        "type": [
          "string",
          "null"
        ]
      },
      "found": {
        "type": "boolean",
        "description": "True when the program is found"
      }
    },
    "required": [
      "path",
      "found"
    ],
    "additionalProperties": {}
  }
}