Hola a todos, tengo el siguiente código:
if [[ "$TARGET" =~ "$REPLY" ]];then
else
arpspoof -i "$INTERFACE" -t "$REPLY" "$ROUTER_INET_IP" 2> /dev/null &
arpspoof -i "$INTERFACE" -t "$ROUTER_INET_IP" "$REPLY" 2> /dev/null &
TARGET=${TARGET}" "$REPLY
echo "IP:$REPLY"
let "COUNT += 1"
fi
Cómo podría hacer para eliminar el else, entiendo que debo negar la condición, pero no lo logro:
!=~
o con
]if [![ "$TARGET" =~ "$REPLY" ]];then
Saludos
1-usar doble quotes (") no es necesario si usas "[["
2-Usa "!" asi: stackoverflow.com/questions/4542732/how-do-i-negate-a-test-with-regular-expressions-in-a-bash-script
if [[ ! $TARGET =~ $REPLY ]];then
3-tambien podrias usar ":" en el true del if sin cambiar nada mas del codigo
stackoverflow.com/questions/3224878/what-is-the-purpose-of-the-colon-gnu-bash-builtin
Me ha quedado todo muy claro, muchísimas gracias. Cierro el post, saludos