The ifcfg network utility

This program is a quick and dirty trick, but is very useful when one needs to manipulate a network configuration with a shell script. If, in a shell script, you need to get your IP address (which might not be a static one), it is really painful to obtain it with ifconfig and filtering. The purpose of ifcfg is to make something like ifcfg, but easy to use in scripting.

Here is an short example of use:

bayartb@edgard:~$ ifcfg -pa ppp0
80.67.176.0
bayartb@edgard:~$ ifcfg -pe ppp1
no
bayartb@edgard:~$ if ifcfg -e ppp1; then
> echo ppp1 exists
> else
> echo ppp1 doest not exist
> fi
ppp1 doest not exist

The source tarball is available here.

A first example of a possible Debian package (poorly made, will be improved) is available here.

For now, this program works properly with recent linux kernels. I did not bother to make it work with anything else, since I use nothing else. I would be pleased to receive patches to make it works with other unix-like systems, specialy the BSD ones.

Bugs

Bug reports, or improvements, can be sent to my e-mail address (see below) and will be handled... when I've time. Thanks to put the flag [bug] in the subject of your e-mail.

bayartb at edgard dot fdn dot fr