I'm on FreeBSD's csh. I want to form a row with domains of one user and then use this row to filter exim maillog to get only mail from/to this user's domains.
I wrote a script to form a row from a list of DirectAdmin-domains:
#!/bin/sh user="some-user" list=$(cat /usr/local/directadmin/data/users/$user/domains.list) domaincount=$(echo $list|wc -w) echo $list| tr ' ' '|'
Executing this script returns rows with domains like this:
'domain.com' or this:
Now I want to use this as an argument to
cat /var/log/exim/mainlog |egrep `/path/to/rowscript`
returns nothing, while replacing manually
/path/to/rowscript with its result returns what I want to see.
Tried to use
grep -E "`/path/to/rowscript`", egrep '`/path/to/rowscript`' egrep `/bin/sh /path/to/rowscript` egrep $(/path/to/rowscript) getting "Illegal variable name."
etc., but still no luck.
date in backticks works well:
cat /var/log/exim/mainlog | grep `date +%Y-%m-%d`
What am I doing wrong?