小编rsm*_*ith的帖子

bash语法错误:"("意外

由于某种原因,此功能正常工作,终端正在输出

newbootstrap.sh: 2: Syntax error: "(" unexpected
Run Code Online (Sandbox Code Playgroud)

这是我的代码(第2行是函数MoveToTarget() {)

#!/bin/bash  
function MoveToTarget() {
    #This takes to 2 arguments: source and target
    cp -r -f "$1" "$2"
    rm -r -f "$1"
}

function WaitForProcessToEnd() {
    #This takes 1 argument. The PID to wait for
    #Unlike the AutoIt version, this sleeps 1 second
    while [ $(kill -0 "$1") ]; do
            sleep 1
    done
}

function RunApplication() {
    #This takes 1 application, the path to the thing to execute
    exec "$1" …
Run Code Online (Sandbox Code Playgroud)

linux macos bash scripting syntax-error

12
推荐指数
2
解决办法
1万
查看次数

标签 统计

bash ×1

linux ×1

macos ×1

scripting ×1

syntax-error ×1