# Example Usage

### Calling simple, static commands

Any command supplied to a Shell Script query will be executed on the remote host. A simple application might allow a user to click a button to get the uptime of that machine. To do this, we need a query that calls "uptime", a button to trigger this query, and a place to display the result.

![Uptime query](https://d3399nw8s4ngfo.cloudfront.net/docs/rd/8716af3-Screen_Shot_2021-07-23_at_5.01.31_PM.png)

The result of a Shell Script query is an object with three keys:

- `exitCode`: the exit code from the process
- `stdErr`: standard error from the process
- `stdOut`: the standard out from the process

![A text component displaying the results of `getUptime.data.stdOut`](https://d3399nw8s4ngfo.cloudfront.net/docs/rd/53dc785-Screen_Shot_2021-07-23_at_5.05.09_PM.png)

### Calling commands with dynamic arguments

In real applications, we need to trigger commands with dynamic arguments. The Shell Script resource can take arguments from a Retool application via the `{{ }}`. For example, if we had a dropdown with two different commands, we could run one of them by consuming `{{ dropdown1.value }}` as Shell Script arguments.

![Calling a command with dynamic arguments.](https://d3399nw8s4ngfo.cloudfront.net/docs/rd/1cdb3df-Screen_Shot_2021-07-23_at_5.11.18_PM.png)

---

## Run shell scripts on remote hosts

:::info beta

The Shell Script resource is currently in beta and may be modified in backward-incompatible ways. It is only available on Self-hosted Retool.

:::

Imagine you have python scripts that you would like to trigger from a Retool application. You could build an API that accepts requests and runs these scripts, but that is a lot of work to build, deploy, and maintain. If you had to run these scripts manually, you would likely ssh into the remote host and directly call them. The Shell Script resource allows your Retool applications to do this; connect directly to remote machines and execute arbitrary commands.