Filtering duplicate emails with procmail

We have a few departments on campus and each user has a username in at least one department plus the top level domain. This means that if an email is sent to username@dept.company.net and there is a cc to username@company.net Then username will get the email twice. After playing around I found that procmail can track the messageid's of emails in a file, so i have this simple rule to filter out. PMDIR=$HOME/.procmail :0 Whc: msgid.lock | formail -D 4096 $PMDIR/idcache :0 a: Mail/duplicates

:0 Whc: msgid.lock This sends the headers t

Wordpress category: 

Howto iterate through an input stream without a subshell or a read.

It sometimes comes up that the usual trick of reading in a stream with a pipe and a while loop doesn't work, since the pipe causes a subshell and any variables set in the subshell are unavailable to the parent.
For example the normal trick (output the first few lines of the /etc/services file, just the first two columns and not empty or comment lines):

[uphill@zagreb]: grep -v ^# /etc/services | grep -v ^$ | head | awk '{print $1" "$2;}'
tcpmux 1/tcp
tcpmux 1/udp
rje 5/tcp
rje 5/udp
echo 7/tcp
echo 7/udp
discard 9/tcp
discard 9/udp
systat 11/tcp
systat 11/udp
[u
Wordpress category: 

Howto use arrays in bash to store indexed information

Sometimes it's easier to write a quick script in bash that uses arrays rather than figure out how to do it with something more appropriate like awk or perl.

It's really very quick and simple. To start, declare your variable as an array

[uphill@host]: declare -a myvar

If the array is going to be global then add x to export it.

 

Wordpress category: 

.Xdefaults app-defaults not applying automatically

In RHEL4 and possibly other distros. The .Xdefaults file is not used, the file is now called .Xresources In /etc/X11/xinit/xinitrc-common, xrdb is passed .Xresources _after_ /etc/X11/Xresources. You can make systemwide changes in /etc/X11/Xresources, but they will be overridden by changes to .Xresources.
Wordpress category: 

Pages