Postfix

James Wilkinson james at westexe.demon.co.uk
Thu Jan 27 13:32:43 UTC 2005


James McKenzie wrote:
> Looks like this line is in error.  Using a text editor copy this line 
> and remove the double quotes and comment out the original line.  Like this:
> 
> #/usr/sbin/postalias "$alias_database" 2>/dev/null
> /usr/sbin/postalias $alias_database 2>/dev/null
> 
> This should correct the error as I think the line should be looking for 
> your alias file, usually /etc/aliases, and is getting $alias_database 
> instead.
> 
> It should be noted that I am not using postfix here, this is just basic 
> scripting knowledge.

Um. I don't want to talk to the main issue, but for the record...

Bourne-compatible shells (like bash) *will* do variable substitution
within double quotes. I suspect you're thinking about single quotes.

For example:
[james at howells ~]$ echo $TERM
linux
[james at howells ~]$ echo "$TERM"
linux
[james at howells ~]$ echo '$TERM'
$TERM

The double quotes are basically useful for "keeping things together": if
$alias_database was "~/my settings/alias" (urgh), then
/usr/sbin/postalias $alias_database
would be 
/usr/sbin/postalias ~/my settings/alias
which would be interpreted as 
/usr/sbin/postalias "~/my" "settings/alias"
which would probably fail because there is no file ~/my.

/usr/sbin/postalias "$alias_database"
would be interpreted as 
/usr/sbin/postalias "~/my settings/alias"
the Right Thing.

(I do not claim that this pathname is sensible, reasonable, or will not
make you want to scrub your hard drive and start again with OpenBSD in
an attempt to get away from the madness!)

James.
-- 
James Wilkinson       | Please do not put sandwiches in the disk drive.
Exeter    Devon    UK | 
E-mail address: james | 
@westexe.demon.co.uk  | 




More information about the users mailing list