Invoking program when a bash function has the same name

前端 未结 2 1889
[愿得一人]
[愿得一人] 2020-12-09 02:43

I have the following function in my bash script:

make() {
    cd Python-3.2
    make
}

When make is called within this script, this functio

相关标签:
2条回答
  • 2020-12-09 02:51

    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.
    
    0 讨论(0)
  • 2020-12-09 03:05

    Use the full path to the program. E.g. /usr/bin/make.

    If you don't know the full path, you can use the which utility, like:

    $(which make)
    

    That will find the full path and execute make.

    0 讨论(0)
提交回复
热议问题