Problems using some feature of /etc/aliases ...
Hello all , I have problems using the facility of aliases to call a command via a pipe which receives messages via standard input. In the aliases I have this line : crosby-smb:"|/usr/lib/crosby/fwsamba.pl param1 param2" The fwsamba.pl script is a simple one which take the subject and From part and send a samba message about the new mail.The script works fine when I used without any parameters like this : crosby-pager:"|/usr/lib/crosby/fwsamba.pl" If I put the parameters there the command failed.I tried to find from where is the problem and I found it but crosby-pager:"|/usr/lib/crosby/fwsamba.pl" If I put the parameters there the command failed.I tried to find from where is the problem and I found it but I don't know how to solve. I use this command : cat a_text_file | usr/lib/crosby/fwsamba.pl param1 param2 and the output is : Can't open param1: No such file or directory The Perl script seems to see parameters but I can access any more the mail via standard input. How can I specify in the aliases the param1 and param2 are parameters not commands ? Thanks a lot , Crosby. -- "Whatever you do will be insignificant, but it is very important that you do it." --Mahatma Gandhi
Hi Crosby, The problem is not in /etc/aliases but in your perl script. I bet you use <> operator in your script. If there are no parameters on command line, perl reads from standard input. But if there are paramemters on the command line, perl interprets them as file names, tries to open them and read from them with <> operator. HTH, -Kastus On Thu, Apr 19, 2001 at 09:22:44AM +0300, Crosby wrote:
Hello all ,
I have problems using the facility of aliases to call a command via a pipe which receives messages via standard input. In the aliases I have this line : crosby-smb:"|/usr/lib/crosby/fwsamba.pl param1 param2" The fwsamba.pl script is a simple one which take the subject and From part and send a samba message about the new mail.The script works fine when I used without any parameters like this : crosby-pager:"|/usr/lib/crosby/fwsamba.pl" If I put the parameters there the command failed.I tried to find from where is the problem and I found it but crosby-pager:"|/usr/lib/crosby/fwsamba.pl" If I put the parameters there the command failed.I tried to find from where is the problem and I found it but I don't know how to solve. I use this command : cat a_text_file | usr/lib/crosby/fwsamba.pl param1 param2 and the output is : Can't open param1: No such file or directory
The Perl script seems to see parameters but I can access any more the mail via standard input. How can I specify in the aliases the param1 and param2 are parameters not commands ?
Thanks a lot ,
Crosby.
participants (2)
-
Crosby
-
Konstantin (Kastus) Shchuka