> For the complete documentation index, see [llms.txt](https://docs.gentee.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gentee.org/syntax/running-programs.md).

# Running programs

The language has a special command **$** to run applications and operating system commands with the specified parameters. The script takes the entire line up to the newline character and execute it. There must be a space between the **$** and the command line. If this command is used in an expression, it captures the standard output and returns it as a string. Otherwise, the standard output will be visible in the console. You can specify expressions with **%{Expression}** as in a backquoted string. If any parameter contains a space, enclose that parameter in any quotes - *"a b", 'c d', \`e f\`*. If the executable application or command terminates with an error code other than zero, the script will also stop working and return an error.

```
Command = "$ " { unicode_linechar | "%{" Expression "}" | "${" identifier "}" }
```

```
run str {
   $ dir
   str name = $ echo "John Smith"
   return $ echo My name is %{name}
}
```

### Environment Variables

The Gentee language allows you to easily get environment variables and assign values to them. To do this, specify the **$** character before the variable name. In addition, you can substitute the environment variables with the **${ENV\_NAME}** construct in the **$** launch commands and back-quoted strings. This entry is shorter than *%{ $ENV\_NAME }*. Environment variables are always of string type, but you can assign them values of **str**, **int**, and **bool** types.

```
EnvVariable = "$" identifier
```

```
run str {
    $MYVAR = `Go path: ${GOPATH}` + $GOROOT
    return $ echo ${MYVAR}
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gentee.org/syntax/running-programs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
