# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
