Script help

Chris G cl at isbd.net
Tue Feb 12 10:50:34 UTC 2008


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




More information about the fedora-list mailing list