- 主题:踩了bash的一个环境变量的坑
我用javascript写一个Github Action,想在本地运行。然后就参考了官方文档,它是这么说的:
```
When you specify an input, GitHub creates an environment variable for the input with the name INPUT_<VARIABLE_NAME>. The environment variable created converts input names to uppercase letters and replaces spaces with _ characters.
```
我所想不明白的是:我有一个input叫"llvm-version”.我怎么设置都不成功。
正确的env var name应该是: “INPUT_LLVM-VERSION”。 但是bash非说这个环境变量名不符合要求。
后来我明白了,这样的变量名是可以的。只是bash不支持。我写了个python 脚本,用python去运行nodejs并在执行node.exe的同时传入自定义的环境变量就可以了。
--
FROM 115.231.43.*
环境变量是以字母或下划线开头的,中间只能由字母、数字和下划线组成,你的这个减号不符合要求
【 在 snnn 的大作中提到: 】
: 我用javascript写一个Github Action,想在本地运行。然后就参考了官方文档,它是这么说的:
: ```
: When you specify an input, GitHub creates an environment variable for the input with the name INPUT_<VARIABLE_NAME>. The environment variable created converts input names to uppercase letters and replaces spaces with _ characters.
: ...................
--
FROM 120.244.222.198
所以,我要说的是:可以的!!!!你说的只是 bash 的限制。不是操作系统的。
【 在 mengge 的大作中提到: 】
: 环境变量是以字母或下划线开头的,中间只能由字母、数字和下划线组成,你的这个减号不符合要求
:
--
FROM 223.111.166.*
未定义行为而已。
Environment variable names used by the utilities in the Shell and Utilities volume of POSIX.1-2017 consist solely of uppercase letters, digits, and the <underscore> ( '_' ) from the characters defined in Portable Character Set and do not begin with a digit. Other characters may be permitted by an implementation; applications shall tolerate the presence of such names.
【 在 snnn 的大作中提到: 】
: 所以,我要说的是:可以的!!!!你说的只是 bash 的限制。不是操作系统的。
--
FROM 114.247.175.*