LINUX.ORG.RU

Bash. command not found

 


0

1

#!/bin/bash
while true
do
status=`cat status.txt`;
echo $status;
if [$status == «0»]
then
xdotool keydown space;
elif [$status = «1»]
then
xdotool keyup space;
fi
break;
done;


switch.sh: line 6: [0: command not found
switch.sh: line 9: [0: command not found



Чё не так?

Пробел вставь.

anonymous
()

Нет команды [0. Пробел поставь.

anonymous
()
[ megabaks@desktop ] ~ $ status=0
[ megabaks@desktop ] ~ $ if [ $status == "0" ];then echo fail;fi
fail
[ megabaks@desktop ] ~ $ if [$status == "0"];then echo fail;fi
bash: [0: команда не найдена
[ megabaks@desktop ] ~ $ 
megabaks ★★★★
()

больше пробелов!

aol ★★★★★
()
Ответ на: комментарий от megabaks

ты самый цимес не показал..

aol@hp:~$ unset status
aol@hp:~$ if [ $status == "0" ];then echo fail;fi
bash: [: ==: unary operator expected
хотя, да, в данном случае это маловероятно..

aol ★★★★★
()
#!/bin/bash
while true
do
    status=`cat status.txt`
    echo $status
    if [[ $status == "0" ]]
    then
	xdotool keydown space
    elif [[ $status == "1" ]]
    then
	xdotool keyup space
    fi
    break
done
anonymous
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.