允许的字符在linux环境变量名中 [英] Allowed characters in linux environment variable names

查看:199
本文介绍了允许的字符在linux环境变量名中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在linux环境变量名中允许使用什么字符?我的粗体搜索手册页和网页只提供了有关如何使用变量的信息,但不包含哪些名称。

What characters are allowed in linux environment variable names? My cursory search of man pages and the web did only produce information about how to work with variables, but not which names are allowed.

我有一个Java程序,需要一个定义的环境变量包含一个点,像 com.example.fancyproperty 。使用Windows,我可以设置该变量,但我没有运气在linux中设置(在SuSE和Ubuntu中尝试)。是否允许变量名称?

I have a Java program that requires an defined environment variable containing a dot, like com.example.fancyproperty. With Windows I can set that variable, but I had no luck setting it in linux (tried in SuSE and Ubuntu). Is that variable name even allowed?

推荐答案

开放组


这些字符串的形式为
name = value; 名称不得包含
字符'='。
对于符合
IEEE Std 1003.1-2001的系统的值为
的值,该值为

便携式字符集(除NUL
之外,如下所示
)组成。

所以名称可能包含除=和NUL之外的任何字符,但是:

So names may contain any character except = and NUL, but:


Shell中的实用程序和
的实用程序体积IEEE Std
1003.1-2001仅包含大写字母,数字和_
(下划线)
,从字符
在便携式字符集中定义,
不以数字
开头。其他
字符可能被
实现允许;应用程序
可以容忍这些名称的存在。

Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 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.

所以当名字可能有效时,你的shell可能不支持任何除了字母,数字和下划线。

So while the names may be valid, your shell might not support anything besides letters, numbers, and underscores.

这篇关于允许的字符在linux环境变量名中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆