I'm playing around with a little program called Zenity. It is a simple way to call up dialog boxes from a shell script. I've been able to produce a couple of simple examples with just an OK box. There are more complicated examples I'd like to try (this is going into some articles in Call-A.P.P.L.E.). The thing is Zenity can return values to the calling script. I'd like to know how to read these values...
I have done a bit of research. The UNIX textbook I was using at university was written around the csh and didn't really have the information I wanted in a location I could find easily (although I could swear it was there when I took the course a little over 10 years ago). I looked at the man pages for Zenity and BASH. I also looked at several examples in the /etc directory (obviously unsuccessfully). I'll admit to being an airhead occasionally, but this is a really simple problem. Simple problems are the worst ones to solve. :-(
Later Mike
Can't help you with your specific question but here is a good bash scripting reference:
http://advbash.activeventure.net/index.html
Maybe you can find some answers there?
John Lange wrote:
I glanced at this reference and found it quite good. I also learned something new.
Bash will open a network connection using the syntax
/dev/tcp/host/port
or
/dev/udp/host/port
An example connecting to the "daytime" port:
$ cat </dev/tcp/time.nist.gov/13 53463 05-04-03 02:27:51 51 0 0 269.6 UTC(NIST) *
-- Bill
On Sat, 2005-04-02 at 20:31, Bill Reid wrote:
An example connecting to the "daytime" port:
$ cat </dev/tcp/time.nist.gov/13 53463 05-04-03 02:27:51 51 0 0 269.6 UTC(NIST) *
That is a new one! I hadn't noticed it before.
Any mention of how to use it as a two way communication?
What I have in mind is:
echo "GET /" > /dev/tcp/www.server.com/80 cat < /dev/tcp/www.server.com/80 | grep somephrase
John Lange wrote:
Any mention of how to use it as a two way communication?
What I have in mind is:
echo "GET /" > /dev/tcp/www.server.com/80 cat < /dev/tcp/www.server.com/80 | grep somephrase
From your URL: http://advbash.activeventure.net/devref1.html
bash$ exec 5<>/dev/tcp/www.slashdot.org/80 bash$ echo -e "GET / HTTP/1.0\n" >&5 bash$ cat <&5
Wow! Very nice.
Up until now I've been using that site just as a reference to solve specific problems but I think I'll have to find the time to go through the complete site.
BTW, for anyone who writes scripts that accept parameters, there is a decent section on "getops". Lets you specify a whole bunch of command line options to a script in any order. Perhaps this is old-hat for you scripting wizards out there but it was something that always caused me grief before I found this guide.
John
On Mon, 2005-04-04 at 10:08, Bill Reid wrote:
John Lange wrote:
Any mention of how to use it as a two way communication?
What I have in mind is:
echo "GET /" > /dev/tcp/www.server.com/80 cat < /dev/tcp/www.server.com/80 | grep somephrase
From your URL: http://advbash.activeventure.net/devref1.html
bash$ exec 5<>/dev/tcp/www.slashdot.org/80 bash$ echo -e "GET / HTTP/1.0\n" >&5 bash$ cat <&5
On April 2, 2005 05:21 pm, John Lange wrote this amazing epistle:
Can't help you with your specific question but here is a good bash scripting reference:
http://advbash.activeventure.net/index.html
Maybe you can find some answers there?
Bill (a little later along in the list) has a solution for me to try. A check of the website you gave me is more than helpful. It is now in the bookmarks waiting to be printed. It looks as though this site may answer some questions I'd have coming up before I ask them.
Later Mike
Mike Pfaiffer wrote:
took the course a little over 10 years ago). I looked at the man pages for Zenity and BASH. I also looked at several examples in the /etc directory (obviously unsuccessfully). I'll admit to being an airhead occasionally, but this is a really simple problem. Simple problems are the worst ones to solve. :-(
The special parameter $? is the status or return value of the last command.
For example:
zenity --question "Test" echo $?
$? is 0 for "OK" and is 1 for "Cancel"
Thanks for asking the question. I have used "dialog" for similar purposes but zenity looks quite nice.
Good luck, Bill
On April 2, 2005 07:53 pm, Bill Reid wrote this amazing epistle:
Mike Pfaiffer wrote:
took the course a little over 10 years ago). I looked at the man pages for Zenity and BASH. I also looked at several examples in the /etc directory (obviously unsuccessfully). I'll admit to being an airhead occasionally, but this is a really simple problem. Simple problems are the worst ones to solve. :-(
The special parameter $? is the status or return value of the last command.
For example:
zenity --question "Test" echo $?
$? is 0 for "OK" and is 1 for "Cancel"
Thanks for asking the question. I have used "dialog" for similar purposes but zenity looks quite nice.
Good luck, Bill
WOW! Thanks. I'm going to try this in a couple of minutes. Your reply is getting printed and will be next to the Zenity man page in a binder of notes.
Later Mike