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

时间:2015-10-06 20:57:36

标签: linux environment-variables perforce

我尝试按照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

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

2 个答案:

答案 0 :(得分:3)

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

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

答案 1 :(得分:3)

升级到最新版本的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