Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Oct 2001 12:43:59 -0500
From:      Mike Meyer <mwm@mired.org>
To:        "jason" <kib@mediaone.net>
Cc:        questions@freebsd.org
Subject:   Re: creating conf files through scripting
Message-ID:  <15296.37983.777462.423620@guru.mired.org>
In-Reply-To: <01bd01c14f52$bd07c480$05d85c42@speakeasy.net>
References:  <15296.30192.124715.492534@guru.mired.org> <01bd01c14f52$bd07c480$05d85c42@speakeasy.net>

next in thread | previous in thread | raw e-mail | index | archive | help
jason <kib@mediaone.net> types:
> > jason <jasonc@concentric.net> types:
> > That's hard to do, because the shell is a tool for tying together all
> > the tools that you have available. That varies far to much to keep
> > track of.
> That is exactly the same thing I have been seeing.  No one wants to discuss
> anymroe than ls, rm, mv, cp, pwd, cd and the like.

Well, you missed the two most important tools: sed and awk. Awk is
sufficient to be a scripting language unto itself, but it's also vary
useful for manipulating data on lines. Other things to look at are rs,
cut, paste, and colrm. Or are those the things you mean when you say
"and the like"? If so - well, those are the tools I use when writing
shell scripts.

> > My two favorite books on this topic are "Unix Power Tools" by Jerry
> > Peek et. al., and "The Unix Programming Environment" by Kernighan and
> > Pike.
> I prefer online versions.  Since I can get immediate access to them.  At
> present I do not have the ability to reach a local bookstore and would
> rather not wait 2 weeks for some online place to ship it.  Plus the online
> versions are cheaper.  :)

Can't help you there. If the man pages and GNU documentation on the
things aren't enough, I don't know what else to recommend. It's not
completely unheard of for a google search to turn up tutorials and
examples. Have you tried that?

> > > Or maybe tell me if and how I can call on PHP scripts to do what I want?
> So
> > > far everything I read on PHP is web server based.
> > Well, you might consider a script that does the web interactions. For
> > instance, if you have to fill out a single form and submit it, and the
> This I can do right now.  I have a php script that when called simply
> creates the file on the webserver and outputs it the web browser in html.
> But the problem is getting it to the machine that needs it.  Since it
> outputs to html I have this test folder of the web server protected by
> .htaccess using mod_auth_mysql.  Which means I still have yet to find an
> automatic way for the requesting system to send a password.

Use python. The problem with doing this one in telnet/etc. is that you
have to construct the authentication header by hand. Python will do
that for you.

> > program that handles it will work with a GET, you can construct a URL
> > and use fetch in the base system to do it. If you need to do a POST or
> > do authentication, then consider using Python and the urllib module,
> > which will handle all those things. Since it doesn't depend on a lot
> > of external tools, the comprehensive reference guides are the language
> > and library references.
> Python looks ok.  But as I read the web site there is no BSD support listed
> and I am not so good and creating my own ports.  Also loading that program
> would require disk space and at present I am trying to avoid loading
> anything new because my 520MB hd has /usr at 76% compacity already.

You don't need to create a port, you just need to install the one in
lang/python. Python is very portable - far more portable than most
shell or perl scripts.

> What I need to know is this.  What tools can sh use to telnet. 

Look in the ports tree. Expect talking to telnet is the conventional
solution, but there's netscript, ncat, suckblow, tcpcat and ucspi-tcp
could all be used to do the job. You can also considering mounting
using the tcp portal which is in the base system. See the mount_portal
man page for details.

> I also need to know what tools sh can use in order to create a file and
> write data to it from the query.

Mysql has - well, had when I last used it 3 years ago - a command line
interface. You write scripts in SQL and feed them to that.

The python modules to access MySQL databases are in the ports tree as
well.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Q: How do you make the gods laugh?		A: Tell them your plans.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15296.37983.777462.423620>