我尝试在shell脚本中添加sleep命令。但是它显示"语法错误:当我运行sh文件时参数' 2无效。但是,当我直接发送到提示控制台时,睡眠命令可以正常工作。该
.sh文件脚本如下:
'#!/bin/sh
sendevent /dev/input/event2 3 57 11
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 1 325 1
sendevent /dev/input/event2 3 53 1343
sendevent /dev/input/event2 3 54 2403
sendevent /dev/input/event2 3 48 3
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 3 53 1341
sendevent /dev/input/event2 3 54 2401
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 3 57 -1
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 1 325 0
sendevent /dev/input/event2 0 0 0
sleep 2
sendevent /dev/input/event2 3 57 12
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 1 325 1
sendevent /dev/input/event2 3 53 1004
sendevent /dev/input/event2 3 54 924
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 3 57 -1
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 1 325 0
sendevent /dev/input/event2 0 0 0
大家可以帮我检查一下吗?
答案 0 :(得分:0)
更新谁想知道。答案很简单,只需添加“;”在睡眠命令结束时
sendevent /dev/input/event2 0 0 0 Sleep;