Это так просто, но я не могу заставить его работать.Я хочу сделать простой оператор if в скрипте ssh bash.Вот мой код ниже:
#!/bin/sh
echo -n "enter what type of logs. (ie. cpanel, apache) "
read type
if [$type == cpanel]
then
LOGTYPES ="error, access"
else
LOGTYPES ="error, access, suphp, suexec"
fi
echo -n "enter which log to tail (ie. $LOGTYPES) "
read logs
echo -n "enter last number of lines to view. (ie. 10, 5000 etc) "
read lines
tail -$lines /usr/local/$type\/logs/$logs\_log
Я пробовал все, и я получаю эту ошибку:
[~]# /apachetail
enter what type of logs. (ie. cpanel, apache) cpanel
/apachetail: line 5: [cpanel: command not found
/apachetail: line 9: LOGTYPES: command not found
enter which log to tail (ie. )
Я пробовал следующие методы, ни один не работает:
if [$type -eq cpanel]
if [$type -eq cpanel];
if [$type == cpanel];
if [$type = cpanel]
if [$type = cpanel];
if ["$type" = cpanel]
if ["$type" = cpanel];
if ["$type" == cpanel]
if ["$type" == cpanel];
if ["$type" -eq cpanel];
if ["$type" -eq cpanel]