No caso de string troca "==" por "=" *Mathematical Operator in Shell Script **Meaning**Normal Arithmetical/ Mathematical Statements* *But in Shell* *For test statement with if command* *For [ expr ] statement with if command*-eqis equal to5 == 6if test 5 -eq 6if [ 5 -eq 6 ]-neis not equal to5 != 6if test 5 -ne 6 if [ 5 -ne 6 ]-ltis less than5 < 6if test 5 -lt 6if [ 5 -lt 6 ]-leis less than or equal to5 <= 6if test 5 -le 6 if [ 5 -le 6 ]-gtis greater than5 > 6if test 5 -gt 6if [ 5 -gt 6 ]-geis greater than or equal to5 >= 6if test 5 -ge 6 if [ 5 -ge 6 ]
*NOTE:* == is equal, != is not equal. *For string Comparisons use* *Operator**Meaning*string1 = string2string1 is equal to string2string1 != string2 string1 is NOT equal to string2string1string1 is NOT NULL or not defined -n string1string1 is NOT NULL and does exist -z string1string1 is NULL and does exist *Maurício Magalhães.*Analista de Rede e Segurança. ITIL® V3 Certification, Em 12 de agosto de 2014 22:46, Mauricio Magalhães < mauriciommagalh...@gmail.com> escreveu: > Desculpe me enganei tenta no lugar de "==" use -eq > > Abs > > > > > *Maurício Magalhães.*Analista de Rede e Segurança. > ITIL® V3 Certification, > > > > Em 12 de agosto de 2014 22:34, Mauricio Magalhães < > mauriciommagalh...@gmail.com> escreveu: > > Vc ta invertendo, >> >> o correto é = "$teste" == "PRI span 1/0: In Alarm, Up, Active" (Se for >> diferente da string CORRETA" >> >> ENTÃO OI OFF >> >> SENÃO OI ON >> >> aBS >> >> >> >> >> *Maurício Magalhães. *Analista de Rede e Segurança. >> ITIL® V3 Certification, >> >> >> >> 2014-08-12 21:50 GMT-03:00 Eder MC <eder.a...@gmail.com>: >> >>> Ola galera >>> >>> estou tentando fazer um script para testar e fazer algo caso meu E1 pare. >>> >>> ##!/bin/bash >>> teste= asterisk -rnx "pri show spans" >>> echo $teste >>> if [ "$teste" == "PRI span 1/0: In Alarm, Down, Active" ]; >>> then >>> echo "OI OFF" >>> else >>> echo "OI ON" >>> fi >>> >>> copiei a string de acordo com o comando, porem ele passa como OK...sendo >>> que ta OFF >>> >>> >>> vlw >>> >>> _______________________________________________ >>> >>> WORKOFFEE KHOMP: Eventos Khomp na sua cidade! Desenvolva seu >>> conhecimento na tecnologia e portfólio Khomp. Próxima edição >>> em CURITIBA, 7 de agosto. Inscrições GRATUITAS. >>> Garanta a sua vaga e saiba mais em: www.workoffee.com.br >>> _______________________________________________ >>> >>> ALIGERA – Fabricante e desenvolvedor nacional de Soluções para telefonia >>> IP . >>> Gateway Sip, Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express. >>> Banco de Canais Analógicos – Appliance Asterisk >>> Acesse www.aligera.com.br >>> _______________________________________________ >>> Para remover seu email desta lista, basta enviar um email em branco para >>> asteriskbrasil-unsubscr...@listas.asteriskbrasil.org >>> >> >> >
_______________________________________________ WORKOFFEE KHOMP: Eventos Khomp na sua cidade! Desenvolva seu conhecimento na tecnologia e portfólio Khomp. Próxima edição em CURITIBA, 7 de agosto. Inscrições GRATUITAS. Garanta a sua vaga e saiba mais em: www.workoffee.com.br _______________________________________________ ALIGERA Fabricante e desenvolvedor nacional de Soluções para telefonia IP . Gateway Sip, Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express. Banco de Canais Analógicos Appliance Asterisk Acesse www.aligera.com.br _______________________________________________ Para remover seu email desta lista, basta enviar um email em branco para asteriskbrasil-unsubscr...@listas.asteriskbrasil.org