OT: Bash script for Mailman export of email addresses
Nils Kassube
kassube at gmx.net
Tue Jan 15 19:43:01 UTC 2013
Nigel Ridley wrote:
> On 01/15/2013 09:07 AM, Nils Kassube wrote:
> > I think you should use the proper values directly where ${whatever}
> > is used in the script. Otherwise you should use real variable
> > names without spaces. Something like
> >
> > listserv=box220.bluehost.com
> > listname=somelistname
> > adminpassword=myverysecretpassword
> > wget -O - --post-data adminpw=${adminpassword} \
> > http://${listserv}/admin.cgi/${listname}/members | .....
>
> I did use real variable names without spaces:
> wget -O - --post-data 'adminpw=${myverysecretpassword}'
> http://${box220.bluehost.com/mailman/admin/mypersonalmailinglist/}/ad
> min.cgi/${mailinglistname}/members
>
> | egrep "_realname" | sed
> | 's/^.*value="\([^"]*\)".*value="\([^"]*\)".*$/\1,\2/' | sed
> | 's/%40/@/'
> |
> > maillist.csv
>
> Is that what you meant?
No, sorry - I didn't explain it good enough. If you use variables it
would look like my example above. However it looks like you inserted the
actual values you want to use between the braces. The expression
${WHATEVER} is replaced by the shell with the text stored in the
variable WHATEVER. But your "variable name"
"box220.bluehost.com/mailman/admin/mypersonalmailinglist/" is not a
valid shell variable name and therefore the shell complains.
As your intended action seems to be a one time job, it is not really
useful to use a lot of variables. Instead you could insert your wanted
expressions instead. Then the command would look like this:
wget -O - --post-data 'adminpw=myverysecretpassword' \
http://box220.bluehost.com/mailman/admin/mypersonalmailinglist/admin.cgi/mailinglistname/members | ....
Please note that there are no "$" or braces left in this first part
of the command.
Nils
More information about the kubuntu-users
mailing list