문제

Suppose I have a program named abc in the search path, and I write a script containing the following:

#!/bin/sh
abc() {
    echo Hello
}
$1

Invoking this script with a parameter abc calls the function. Is there a way to always run the external program instead?

도움이 되었습니까?

해결책

OK, this seems to do the job:

#!/bin/sh
abc() {
    echo Hello
}

# calls whatever the argument contains in a new context
sh -c $1

# I can still call my function
abc
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top