<<< Date Index >>>     <<< Thread Index >>>

Re: Adding entries to ldap addressbook



Hi,

Thansk, that makes a lot  of sense.
Unfortantly, it does not yet work completly. I want the script to scan the 
eMail for default values, but afterwards ask the user to confirm or correct 
these default values.
So the script needs to get the eMail from stdin, but also be intaractive with 
the user (utilizing the read command).

If I do:
<pipe-message>script<enter>

The read command just exits, as if I press enter.
Both
<pipe-message><shell-escape>script<enter>

<shell-escape><pipe-message>script<enter>

Both do not work :(

Thanks!
Nathan

On Wed, Feb 27, 2008 at 03:03:14PM -0600, Kyle Wheeler wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wednesday, February 27 at 06:40 PM, quoth Nathan Huesken:
> >I invoke the script this way:
> >macro index,pager a '<shell-escape>~/add2ldap<enter>'
> >
> >It then asks me for the name and eMail (because they are not given as 
> >paramters).
> >So far so good, but I wonder if it is possible to automaticly extract name 
> >and sender from an eMail and pass them as parameters to add2ldap?
> 
> Sure, all you have to do is create a script that will extract those 
> details.
> 
> If, for example, you have DJB's mess822 package installed, you could 
> do something like this:
> 
>      #!/bin/bash
>      FROM=`822field from`
>      if [[ $FROM =~ "<*@*>" ]] ; then
>          EMAIL=`sed 's/.*<\([^>]*\)>.*/\1/' <<<"$FROM"`
>          NAME=`sed 's/ *\(.*\)  *<.*/\1/' <<<"$FROM"`
>      else
>          EMAIL="$FROM"
>          NAME=""
>      fi
>      exec add2ldap "$NAME" "$EMAIL"
> 
> If you don't have the mess822 package, you can do something similar if 
> you have the formail (part of the procmail package) binary handy. The 
> equivalent command would be:
> 
>      FROM=`formail -c -x From`
> 
> ~Kyle
> - -- 
> I have an existential map; it has 'you are here' written all over it.
>                                                        -- Steven Wright
> -----BEGIN PGP SIGNATURE-----
> Comment: Thank you for using encryption!
> 
> iD8DBQFHxdARBkIOoMqOI14RAtOnAKDXwj+3Sv7YOfQBldKjay83lZcPwACcCMHu
> 5HpqldpCD1qq9n2qCGEq//4=
> =poQT
> -----END PGP SIGNATURE-----