Just had a weird situation, where I wrote a quick and dirty shell script to output the current amount of deferred mails due to smtp error 421 and send an alert.
I tried to count the different responses, each smtp response holding an integer as value:
421ips=$(mailq | grep -i -c "refused to talk to me: 421 4.7.1 Intrusion prevention active")
-bash: 421ips=11: command not found
421notaccepting=$(mailq | grep -i -c "421 4.3.2 System not accepting network messages")
-bash: 421notaccepting=11: command not found
421rate=$(mailq | grep -i -c "Our system has detected an unusual rate of 421-4.7.0 unsolicited mail")
-bash: 421rate=6: command not found
I was wondering what the hell just happened until I tried a plain simple variable name:
BLA="$(mailq | grep -i -c "refused to talk to me: 421 4.7.1 Intrusion prevention active")"
Here no error occurred. And that's the moment it hit me: Of course!
Do not start the variable's name with an integer (in this case 421). D'oh!
Distractions, distractions... My mind has been wandering all day.
Actually if I would have used vim with the syntax on command, I would have seen that something's off:
See the $4 turning blue while the rest doesn't? That would have given me a clue.
But as I just created the file, vim didn't know (yet) that it'll be a shell script and therefore couldn't show the syntax highlighting. Only after a close (and save) and reopen with vim the syntax highlights are shown.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Container Containers CouchDB DB DNS Database Databases Docker ELK ElasticSearch Elasticsearch Filebeat FreeBSD GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Icingaweb2 InfluxDB Internet Java KVM Kibana Kubernetes LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher SSL Security Shell SmartOS Solaris Surveillance SystemD TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder