Bryce Nesbitt:
> Here is try two at the end of line comment script for /etc/aliases. Can
> anyone do this more elegantly?
>
> #!/bin/sh
> # Created so we can have end of line comments in /etc/aliases
> sed 's/#.*$//;/^$/d' < /etc/aliases > /tmp/aliases_tmp ;
> /usr/sbin/sendmail -bi -oA/tmp/aliases_tmp ; mv /tmp/aliases_tmp.db
> /etc/aliases.db
The /etc/aliases file uses email address notation as defined in
Internet standards such as RFC 822. When you have a chance to look
up this 27-year old document, then you will discover that it
describes a recursive language.
For this reason, the contents of /etc/aliases cannot be parsed
correctly with regular expressions
In case you aren't aware of this, /#.*$/ is a regular expression.
Wietse