Re: Script help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 12 Feb 2008, Tom Brown wrote:

>
> >
> > $ IP="1234.2345.3456.4578"
> > $ echo $IP | cut -d. -f3
> > 3456
> >
> >   by the way, i don't think it solves any of your exact problems, but
> >
> > $ man ipcalc
> >
> >
>
>
> thanks all - i have 'solved' this in my case (no pun intended) with the
> following
>
> ADDR=`ifconfig | grep inet | head -1 | awk {'print$2'} | cut -d. -f3`
>
> case "$ADDR" in
>    66)
>         wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.66;
>         ;;
>    76)
>         wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.76';
>         ;;
>    77)
>         wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.77';
>         ;;
>    78)
>         wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.78';
>         ;;
>    86)
>         wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.86';
>         ;;
>    *)
>         wget
> http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.default;
>         ;;
> esac

what about:

case "$ADDR" in
   66|76|77|78|86)
        wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.${ADDR};
        ;;
   *)
        wget http://192.168.10.4/cobbler/ks_mirror/posts/autofs/auto.xxx.default;
       ;;
esac

  i'm fairly sure that would work.

rday
--


========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux