Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
lizhengbo
V2EX  ›  Linux

这个问题有点理解不了

  •  
  •   lizhengbo · Feb 20, 2022 · 2688 views
    This topic created in 1568 days ago, the information mentioned may be changed or developed.

    在这样的练习中“A=B”且“B=C”,若我下达“unset $A”,则取消的变量是 A 还是 B ? 被取消的是 B 喔,因为 unset $A 相当于 unset B 所以取消的是 B ,A 会继续存在!

    4 replies    2022-02-27 18:57:20 +08:00
    mschultz
        1
    mschultz  
       Feb 20, 2022   ❤️ 1
    In the (*nix) shell, by default, all variables are considered and stored as strings. 可以认为执行 "unset $A",与执行 "unset B" 是等价的
    mschultz
        2
    mschultz  
       Feb 20, 2022   ❤️ 2
    unset A - 取消 A
    unset B - 取消 B

    令 A=B (即:变量 $A 的内容为字符 "B")

    unset $A 等价于 unset B 就是简单的字符代入
    lizhengbo
        3
    lizhengbo  
    OP
       Feb 27, 2022
    @mschultz 谢谢回答!
    lizhengbo
        4
    lizhengbo  
    OP
       Feb 27, 2022
    @mschultz 谢谢回答
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2952 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:08 · PVG 21:08 · LAX 06:08 · JFK 09:08
    ♥ Do have faith in what you're doing.