调用程序时,bash函数具有相同的名称 [英] Invoking program when a bash function has the same name

查看:187
本文介绍了调用程序时,bash函数具有相同的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下功能在我的bash脚本:

I have the following function in my bash script:

make() {
    cd Python-3.2
    make
}

在提出的是这个脚本中调用这个函数被调用,它递归。到呼叫使函数应实际调用外部make实用程序中。除了重命名我的化妆功能,什么是实现这一目标的干净的方式?

When make is called within this script, this function is invoked, which recurses. The call to make inside the function should actually invoke the external make utility. Other than renaming my make function, what's the cleanest way to achieve this?

推荐答案

您可以使用命令内置于燮preSS shell函数查找。

You can use the command built-in to suppress shell function lookups.

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.

这篇关于调用程序时,bash函数具有相同的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆