> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/run.md).

# run

シークレットを環境変数としてアプリケーションまたはスクリプトに渡します。

```
op run -- <command> <command>... [flags]
```

#### **Flags** <a href="#w7390klimve8" id="w7390klimve8"></a>

```
--env-file stringArray   Enable Dotenv integration with specific Dotenv files to
                         parse. For example: --env-file=.env.
--no-masking             Disable masking of secrets on stdout and stderr.
```

`op run`環境変数をスキャンしてシークレット参照を探し、1Password から対応するシークレットをロードし、サブプロセスの実行中はシークレットを環境変数として利用できるようにして、提供されたコマンドをサブプロセスで実行します。

承認されたターミナル セッション内のプロセスがアクセスできる 1Password アイテムを制限するには、使うアイテムを`op run`別の保管庫に移動し、その保管庫にのみアクセスできるサービス アカウントでコマンドを使用します。

[サービス アカウントの詳細をご覧ください。](https://developer.1password.com/docs/service-accounts/)

[秘密の参照について詳しく紹介します。](https://developer.1password.com/docs/cli/secret-references/)

シェルと環境ファイルの両方に同じ環境変数名が存在する場合は、環境ファイルが優先されます。

複数の環境ファイルに同じ環境変数名が存在する場合、最後の環境ファイルが優先されます。

stdout または stderr に出力される秘密は、デフォルトでは隠されています。 マスクをオフにするには、`--no-masking`フラグを含めます。

#### [**例**](https://developer.1password.com/docs/cli/reference/commands/run/#examples) <a href="#gkixlycni47v" id="gkixlycni47v"></a>

secretの値を印刷:

```
export DB_PASSWORD="op://app-prod/db/password"
```

```
op run -- printenv DB_PASSWORD
<concealed by 1Password>
```

```
op run --no-masking -- printenv DB_PASSWORD
fX6nWkhANeyGE27SQGhYQ
```

環境ファイルを指定して使用します。

```
echo "DB_PASSWORD=op://app-dev/db/password" > .env
```

```
op run --env-file="./.env" -- printenv DB_PASSWORD
password
```

シークレット参照内の変数を使用して、さまざまな環境のさまざまなシークレット セットを切り替えます。

```
cat .env
DB_USERNAME = op://$APP_ENV/db/username
DB_PASSWORD = op://$APP_ENV/db/password
```

```
export APP_ENV="dev"
op run --env-file="./.env" -- printenv DB_PASSWORD
dev
```

```
export APP_ENV="prod"
op run --env-file="./.env" -- printenv DB_PASSWORD
prod
```


---

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

```
GET https://manual.dxable.com/1password/run.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.
