为什么 Perforce 不能在 Linux 上设置环境变量?

Why can Perforce not set environment variables on Linux?

我试图按照 Perforce 网站上 this post 中的步骤设置 P4IGNORE 文件。

在 Linux、运行

p4 set P4IGNORE=.ignore

导致出现以下错误消息:

Perforce client warning:
    Can't set registry on UNIX.

阅读 p4 set 的帮助条目,似乎只能用于在 Windows 和 Mac OS X 上设置 Perforce 变量。在 Linux,我不得不使用原生 shell 命令,即

export P4IGNORE=.ignore

我的问题是 - 为什么 p4 set 命令在 Linux 上不起作用,而它是为 Windows 和 OS X(也是基于 Unix 的)实现的?

Windows,p4 set 更新注册表。在 OS X 上,p4 set 更新用户首选项文件。

Linux 上没有注册表或首选项,因此默认使用环境变量。 p4 set 不可能更新父 shell 的环境变量,更不用说使它们永久化了。您需要编辑 shell 个启动文件来设置环境变量。

升级到最新版本的 p4 CLI(或至少版本 2014.2):

Major new functionality in 2014.2

    Other platforms, such as Linux, will now set an environment
    file.  The environment file is available on all platforms
    if a P4ENVIRO environment variable is set to a file path.
    P4ENVIRO will default to a file '.p4enviro' in the user's
    home directory for systems which do not have system provided
    facilities.  The p4 enviro file can be shared across platforms.
    The 'p4 set' command can be used to manipulate or inspect
    this new environment facility.  Note that these special
    'P4_<p4port>_CHARSET' values will only appear in 'p4 set'
    output for the specified or current P4PORT value.
    For instance 'p4 -p perforce:4666 set' will report on
    'P4_perforce:4666_CHARSET' if it is set.

http://www.perforce.com/perforce/doc.current/user/relnotes.txt