

亚马逊 CodeCatalyst 不再向新买家开放。现有客户可以继续正常使用该服务。有关更多信息，请参阅 [如何从中迁移 CodeCatalyst](migration.md)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Devfile 命令
<a name="devenvironment-devfile-commands"></a>

目前， CodeCatalyst 仅支持你的开发文件中的`exec`命令。有关更多信息，请参阅 Devfile.io 文档中的 [Adding commands](https://devfile.io/docs/2.0.0/adding-commands)。

以下示例说明如何在 devfile 中指定 `exec` 命令。

```
commands:
  - id: setupscript
    exec:
      component: test
      commandLine: "chmod +x script.sh"
      workingDir: /projects/devfiles
  - id: executescript
    exec:
      component: test
      commandLine: "./projects/devfiles/script.sh"
  - id: updateyum
    exec:
      component: test
      commandLine: "yum -y update --security"
```

连接到开发环境后，您可以通过终端执行定义的命令。

```
/aws/mde/mde command <command-id>
/aws/mde/mde command executescript
```

对于长时间运行的命令，您可以使用流标志 `-s` 来实时输出命令的执行。

```
/aws/mde/mde -s command <command-id>
```

**注意**  
`command-id` 必须小写。

## 支持的 exec 参数 CodeCatalyst
<a name="devenvironment-exec-support"></a>

CodeCatalyst 在 devfile 版本 2.0.0 上支持以下`exec`参数。
+ `commandLine`
+ `component`
+ `id`
+ `workingDir`