On Mon, 13 Nov 2000, Dan Brown wrote:
> In the course of refining my dyndns.org client from its current rough
> state, I'm trying to figure out how to do two things in a bash script:
>
> 1. Evaluate the first word in a two-word string. For example, the
> string might say "good 192.168.1.1", and I need to test for "good". I
> can write the string to a file and grep the file, but that seems like a
> really messy way of doing this--especially since there are a number of
> possible conditions I want to test for.
Plenty of ways to do this (including set --, which I use a lot). Here's
one:
case "$string" in
good*) echo yes ;;
*) echo no ;;
esac
> 2. Send messages to the system log--I'm wanting the client to log
> results to /var/log/messages. I can always echo foo >>
> /var/log/messages, but again, this seems like a bad way of doing it.
You bet - synchronisation required.
> I could also use a separate log file, but it seems like messages is a more
> appropriate place for this to go.
man logger
> I'm sure the first is a basic bash scripting question, and a decent
> reference on bash scripting would answer it, but I'm not sure where to
> find one of those either. Thanks for any suggestions.
Gordon
--
Gordon Rowell [EMAIL PROTECTED]
http://www.e-smith.org (development) http://www.e-smith.com (corporate)
Phone: +1 (613) 564 8000 ext. 4378 Fax: +1 (613) 564 7739
e-smith, inc. 1500-150 Metcalfe St, Ottawa, ON K2P 1P1 Canada