如何比较我的脚本中的数字:
#!/bin/sh
service=myservice
if [ $(ps | grep -v grep | grep $service | wc -l) > 0 ]
then
echo "$service is running!!!"
else
echo "$service is NOT running!!!"
fi
以上不起作用
答案 0 :(得分:0)
使用git bash:
@Override public boolean dispatchKeyEvent(KeyEvent event) {
Log.i("key pressed", String.valueOf(event.getKeyCode()));
if(event.getKeyCode()==KeyEvent.KEY_A/*select required keycode*/){
//perform required task
}
return super.dispatchKeyEvent(event);
}
答案 1 :(得分:0)
感谢@anubhava,我制作了这个剧本
#!/bin/sh
service=myService
if pgrep "$service" > /dev/null
then
echo "$service is running!!!"
else
echo "$service is NOT running!!!"
fi