On Sunday 13 February 2005 03:31 pm, Mark Knecht <[EMAIL PROTECTED]>
wrote:
> On Sun, 13 Feb 2005 14:44:02 -0600, Boyd Stephen Smith Jr.
>
> <[EMAIL PROTECTED]> wrote:
> > On Sunday 13 February 2005 12:22 pm, Mark Knecht
> > <[EMAIL PROTECTED]>
> > wrote:
> > > 2) Pop up a window and tell me about the instrument list
> >
> > While bash has no support for this, you may be able to use GTK binding
> > for some scipting language Perl/Python to do this. Your first stop
> > for this step is the GTK documentation/tutorial.
>
> Gnome allows me to run my bash script in a terminal so now the
> terminal pops up, runs gigdump, greps out the right lines and saves
> them to a temp file. I then cat that file to the same terminal and see
> the results. Good so far.
>
> > > 3) Ask me which on I want to use
>
> Easy to make it ask the question but so far I cannot find the bash
> command to wait for keyboard input. There must be one but I don't see
> it in man bash.
The bash command read will read one line on text into a variable you use it
like:
read foo;
echo $foo;
> > > 4) Ask me a couple more questions that I answer
> >
> > Reapeat steps 2-3; If you want to show a GUI and you are already
> > running gnome, you'll want to learn/use GTK.
>
> Not into GUI programming today. Just want to see if I can get it to
> work. If it does then and it's useful then maybe I'll make a GUI next
> Sunday afternoon.
Well, if you've got a terminal window you should be able to mess around
with bash to do simple stuff. I think there's also some "prompt" command
for bash that lets you choose one item from a list.
I really haven't gotten into interactive bash scripting. But, it's all
there in info bash, I suppose.
I wasn't even sure nautalus/konqueror would open up a terminal window for
the command.
> > > 5) Take the set of answers and send it over the network using some
> > > command like
> > >
> > > echo "command 1" | nc localhost 8888
> > > echo "command 2" | nc localhost 8888
> >
> > Most languages will allow you to execute commands like this with some
> > call. This is all bash does; perl has backticks and a few system
> > calls; python and C also have system calls. You may not even need to
> > have the shell do the piping, as you generally get/provide some handle
> > to/for the stdin/out/err of a subprocess.
>
> Oops - that was beyond my skill level...
Well, in bash you can do stuff like var=`cat myfile` to execute "cat
myfile", capture it's output and stick it in var. You can do similar
stuff with perl. Also, most language have something like C's system()
call so that you can do:
system("./my_helper_script.sh");
with syntax appropriate to the language, but it's quite different from
using baskticks: By default the subprogram uses the same stdin/out/err and
you don't really get a whole lot of information back into the calling
program.
Anyway, if you want to do it in bash, you won't have to worry about this
much, if at all.
--
Boyd Stephen Smith Jr.
[EMAIL PROTECTED]
ICQ: 514984 YM/AIM: DaTwinkDaddy
--
[email protected] mailing list