proxytoworld
V2EX  ›  问与答

求教,修改 wsl 中的/etc/profile,增加 export ,但用 wsl -u xxx 进入之后不会生效

  •  
  •   proxytoworld · Mar 24, 2022 · 1180 views
    This topic created in 1521 days ago, the information mentioned may be changed or developed.
    如题,在 /etc/profile 中增加 export TEST=aaa ,用 wsl -u xx 进入之后,export 中没有这个环境变量。

    目前只找到一个折中的办法,我使用的是 zsh ,在.zshrc 里面 export 就有用。

    除了进入之后 source /etc/profile ,还有啥好办法可以让 /etc/profile 生效吗
    4 replies    2022-03-24 13:15:58 +08:00
    hingle
        1
    hingle  
       Mar 24, 2022
    重启
    proxytoworld
        2
    proxytoworld  
    OP
       Mar 24, 2022
    @hingle 重启宿主机也不起作用,我在虚拟机里面测试,通过 ssh 连接,/etc/profile 可以生效,但是 wsl 不起作用
    julyclyde
        3
    julyclyde  
       Mar 24, 2022
    那是因为你没搞明白 rc 和 profile 的区别
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2853 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 04:53 · PVG 12:53 · LAX 21:53 · JFK 00:53
    ♥ Do have faith in what you're doing.