gpt4 book ai didi

bash - "key=value bash-script"用法记录在哪里?

转载 作者:行者123 更新时间:2023-12-02 02:30:18 24 4
gpt4 key购买 nike

我经常看到 key=value bash-script 将变量传递给 bash 脚本。这是一个例子:

$ echo $0
-bash
$ cat foo.sh
#!/usr/bin/env bash
echo "key1: $key1"
$ key1=value1 ./foo.sh
key1: value1

我检查了Bash Reference Manual .但我无法描述与此用法相关的信息。

最佳答案

第 3.7.4 节“环境”

The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described in Shell Parameters. These assignment statements affect only the environment seen by that command.

关于bash - "key=value bash-script"用法记录在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65128129/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com