在bash配置文件中定义函数时,意外标记'('附近的语法错误

Sah*_*and 2 bash alias function

gac() {
        git add .
        git commit -m "$1"
}
Run Code Online (Sandbox Code Playgroud)

此函数在我的bash配置文件中,当我尝试获取该文件时会引发错误。

$ source ~/.bashrc
bash: /home/sahandz/.bashrc: line 176: syntax error near unexpected token `('
bash: /home/sahandz/.bashrc: line 176: `gac() {'
Run Code Online (Sandbox Code Playgroud)

我不知道为什么。我有另一个函数,看起来像这样,不会引发任何错误:

abcToTestDir() {
        folderName=${1%_*}
        testFolderPath="$testfilespath$folderName"
        abcFilePath="$abcpath$folderName/$1"
        testFilePath="$testFolderPath/$1"

        mkdir -p $testFolderPath
        cp $abcFilePath $testFilePath
}
Run Code Online (Sandbox Code Playgroud)

我的函数定义有什么问题?

wja*_*rea 5

如果gac已经是别名,则会发生这种情况。例如在我的机器上:

$ type ls
ls is aliased to `ls --color=auto'
$ ls(){ true; }
bash: syntax error near unexpected token `('
Run Code Online (Sandbox Code Playgroud)