This product is not supported for your selected Datadog site. ().
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Metadata

ID: bash-code-quality/dont-mask-return-values

Language: Bash

Severity: Warning

Category: Best Practices

Description

Combining export with command substitution on one line hides the exit status of the command. The assignment runs a command, but the overall status comes from export, which usually succeeds. Assign first, then export: foo="$(mycmd)" and then export foo. Literal values such as export foo=bar do not have this problem.

Non-Compliant Code Examples

#!/bin/bash
export foo="$(false)"
export BAR=$(date)
export FOO bar=$(cmd)

Compliant Code Examples

#!/bin/bash
foo="$(false)"
export foo

x=$(date)
export x

export PLAIN=literal

bar=$(cmd)
export FOO bar
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

シームレスな連携。 Datadog Code Security をお試しください