it-slav.se
home
stuff
archives
programming
download
author
contact
links
guestbook
index » programming
The Tao of Programming

In the beginning was the Tao.
The Tao gave birth to Space and Time.
Therefore Space and Time are Yin and Yang of programming.

Programmers that do not comprehend the Tao are always running out of time and space for there programs.
Programmers that comprehend the Tao always have enough time and space to accomplish their goals.

If the Tao is great, then the operating system is great.
If the operating system is great, then the compiler is great.
If the compiler is great, then the application is great.
The user is pleased and their is harmony in the world.

The wise programmer is told about Tao and follows it.
The average programmer is told about Tao and searches for it.
The foolish programmer is told about Tao and laughs at it.

-- Geoffrey James 18th April 1999

Bash script

This script is a bash-script. To provide DNS lookups.
It can be invoked with data from a file or the commandline directly.
I use it this way:
[svvi00@digger]$ echo 190.215.2.0/24 | ./lookup.sh -p -r -s ns.example.com -i

Short, this mean that I lookup one prefix in the reversezon on
ns.example.com.
I use also interactive mode, cause I'm intersted to lookup
those hosts that have reversedata.
Download and try! But use it with care! The script can handle /16 prefix

lookup.sh
Bash ftp script snippet
What about ftp with bash! No problem.
Use with here document technic.
---------- code snippet ---------------
USER="you user"
PASSWD="your secret passwd"
MODE="binary"
HOST="your favorite ftp-site"

# messages goes to ftp.msg and error goes to ftp.error
# can be checked afterwards
#
# start ftp session ARPANET STANDARD #
# Get files #
/usr/bin/ftp -i -n $HOST >ftp.msg 2>ftp.error <<-MAYDAY
user $USER $PASSWD
$MODE
mget *
quit
MAYDAY

# check for ftp application errors, if OK, process downloaded files #
EXITSTATUS=$?
if [ $EXITSTATUS != 0 ]
 then
  # error handling here #
fi

# check for session messages
if [ -s ftp.msg ]
 then
  # session message handling #
fi
if [ -s ftp.error ]
 then
  # session error handling #
fi
---------- end snippet ----------------

I have used this technic with great succes in a big scale!
Copyright © Svante Victorsson 2007; All rights reserved