我的脚本存在问题,如果我的屏幕会话正在运行,我只是想弄清楚(第19行)。 脚本的其余部分正在运行。
#!/bin/bash
echo $PATH // /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
echo "0"
content=$(wget http://interwebs.com/index.php?page=count -q -O -)
z=$(($content / 5))
z=$(($z + 1))
echo $z // 4
lockfile=/var/tmp/mylock
if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
# do stuff here
x=1
count=0
while [ $x -le $z ]
do
$req ="$(ps -ef | grep -i mystatus$count | grep -v grep)"
if [ "$req" = "" ]; then
# run bash script
screen -amds mystatus$count /usr/bin/wget --spider interwebs.com/index.php?page=cronwhatsoever$(( $count +1))-$(( $count +5))
else
echo "Cron running"
fi
x=$(( $x + 1 ))
count=$(( $count +5))
done
# clean up after yourself, and release your trap
rm -f "$lockfile"
trap - INT TERM EXIT
else
echo "Lock Exists: $lockfile owned by $(cat $lockfile)"
fi
sleep 15
它返回第19行:=:未找到命令。实际上正在运行:
ps -ef | grep -i bukkit | grep -v grep
如果我直接在我的终端中运行它,没有问题,所以任何想法如何解决这个问题?
我猜它与PATH有关,但grep位于/ bin / grep。
答案 0 :(得分:1)
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.settings", "com.android.settings.LanguageSettings");
startActivity(intent);
应该是
$req ="$(ps -ef | grep -i mystatus$count | grep -v grep)"
不要在作业的左侧使用 req="$(ps -ef | grep -i mystatus$count | grep -v grep)"
,并且$