加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

当bash函数具有相同名称时调用程序

发布时间:2020-12-15 19:13:28 所属栏目:安全 来源:网络整理
导读:我的bash脚本中有以下功能: make() { cd Python-3.2 make} 当在此脚本中调用make时,将调用此函数,这将被递归。在函数内部进行调用实际上应该调用外部make实用程序。除了重命名我的make功能,实现这一点最干净的方法是什么? 您可以使用内置命令来抑制shel
我的bash脚本中有以下功能:
make() {
    cd Python-3.2
    make
}

当在此脚本中调用make时,将调用此函数,这将被递归。在函数内部进行调用实际上应该调用外部make实用程序。除了重命名我的make功能,实现这一点最干净的方法是什么?

您可以使用内置命令来抑制shell函数查找。
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.

    Runs COMMAND with ARGS suppressing  shell function lookup,or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.

    Options:
      -p    use a default value for PATH that is guaranteed to find all of
        the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND

    Exit Status:
    Returns exit status of COMMAND,or failure if COMMAND is not found.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读