My suggestion is try using xargs to pipe in the output from match to
hostlookup.

man xargs

Nathan

On Tue, 17 Apr 2001, jacob childress wrote:

> 
> this is probably a dumb problem but here goes...
> 
> just for the hell of it, i want my .bash_profile to tell me what host i'm
> connecting from when i log in.  so i have some lines that look like this:
> 
> if $SSH2_CLIENT
> then
>       MYHOST=`echo $SSH2_CLIENT | match_ip.pl | hostlookup.pl`
>       echo Connecting from ${MYHOST}...
> fi
> 
> where match_ip.pl is a perl script that reads a line from STDIN and prints
> the first string that looks like an IP address to STDOUT, and
> hostlookup.pl is a perl script that reads a line from STDIN, does a name
> lookup on that line, and prints the name to STDOUT.
> 
> when i log in, i get an error similar to this:
> bash: 216.141.188.121: command not found
> 
> it looks like bash takes the output of matchip.pl (the IP) and treats it
> as a command to be run, when i just want it to be passed to the STDIN of
> hostlookup.pl.
> 
> now, if i try the following from a command line:
> MYVAR=`echo $SSH2_CLIENT | match_ip.pl | hostlookup.pl`
> echo $MYVAR
> 
> i will get the results i want, so i know that my perl scripts are okay.
> what am i doing wrong in my .bash_profile?
> 
> thanks in advance,
> jacob
> http://www.cpl593h.net/
> 
> 
> ---------------------------------------------------------------------------
> Send administrative requests to [EMAIL PROTECTED]
> 

---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]

Reply via email to