由于某种原因,此功能正常工作,终端正在输出
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)