V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
imn1
V2EX  ›  Bash

bash 脚本能否捕获哪个调用它

  •  
  •   imn1 · 2016-10-22 13:43:40 +08:00 · 1135 次点击
    这是一个创建于 2736 天前的主题,其中的信息可能已经有所发展或是发生改变。
    echo $0 只能显示自己

    例如
    A.sh
    -----------
    #!/bin/bash
    B.sh
    -----------

    B.sh 中能否知道是 A.sh 调用?
    1 条回复    2016-10-22 13:56:56 +08:00
    fangpeishi
        1
    fangpeishi  
       2016-10-22 13:56:56 +08:00
    echo $PPID
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1303 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:40 · PVG 01:40 · LAX 10:40 · JFK 13:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.