Re: Script help

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

 



On Tue, Feb 12, 2008 at 10:23:37AM +0000, Tom Brown wrote:
> Hi
>
> I am scripting some post install bits on a kickstart machine that downloads 
> certain configuration files depending on the network the machine is in.
>
> I am trying to construct an if statement that will run something like
>
>
>
> ADDR=`ifconfig | grep "inet addr" | head -2 | awk '{print$2'} | cut -c 
> 14,15`
>
> if [ "$ADDR" = "11" ] ; then
>        echo "downloading bar"
> fi
>
> if [ "$ADDR" = "12" ] ; then
>        echo "downloading foo"
>
> fi
>
> etc
>
> and there are 5 different configs - If none of the configs are found then 
> it downloads a default - Am i going about this the right way?
>
It sounds like a classic case/switch sequence, in bash you use 'case'.

-- 
Chris Green


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

  Powered by Linux