[pmwiki-users] How to Read Wiki File from Shell . . .
Joachim Durchholz
jo at durchholz.org
Mon Jun 27 04:44:19 CDT 2005
Dominique Faure wrote:
>
> From a previous message posted here (21/04/2005 15:31):
>
> grep '^text=' wiki.d/Main.WikiSandbox | sed -e 's/^text=//' | tr '\262'
> '\012'
There's a better way:
wget -q -O - http://.../pmwiki.php?n=Group.Name;action=source
It doesn't depend on PmWiki page store internals and won't break if the
PmWiki installation does unusual things (like, redefine the newline
character, which I think is done on UTF installations).
wget simply sends an HTTP request to a URL and returns the result.
The -q option prevents wget from being overly talkative; leave out if
you want to see where it failed :-)
The -O option tells wget where to place the returned data. -O - places
it on the standard output, -O some_file would place it in some_file.
action=source tells the PmWiki server to return the bare wikitext, not
its translation to HTML.
If the site has password-protected action=source, you may have to set up
a cookie file and use --load-cookies. I haven't researched the details
for that though.
...
It may be useful to set up a "command-line mode" for PmWiki, to be
activated when PmWiki finds it's not running in a CGI environment. In
that case, it could take its parameters from the command line instead
from the GET variables, and permission checking based on the name of the
Unix user it's running as.
That would take the permission checking pains out, and also make it
easier to test some things from the command line :-)
(Yes, that's a change request for PmWiki. I'm not sure how high up on
the list that should go though.)
Regards,
Jo
More information about the pmwiki-users
mailing list