You are not logged in.

#1 2005-05-07 17:53:50

Stinky
Member
From: The Colony, TX
Registered: 2004-05-28
Posts: 187

ksh script question [Solved]

I won't go into great detail about what I'm actually trying to do, I'll just post a test script and maybe somebody can tell me what the $%#@ I have wrong.  lol.
I have a file called list.txt.  It's contents are:

host1 /directory/on/host1 host2 /directory/on/host2 fileowner somefile
host1 /anotherdirectory/on/host1 host2 /another/directory/on/host2 fileowner anotherfile

Here's a piece of code that I have as a test trying to get some variables to set correctly. 

#!/usr/bin/ksh
for i in list.txt; do
        DevHost=`cat list.txt | awk '{print $1}'`
        DevDir=`cat list.txt | awk '{print $2}'`
        PrdHost=`cat list.txt | awk '{print $3}'`
        PrdDir=`cat list.txt | awk '{print $4}'`
        FileOwner=`cat list.txt | awk '{print $5}'`
        DevFiles=`cat list.txt | awk '{ print $6 }'`
        echo $DevHost
        echo $DevDir
        echo $PrdHost
        echo $PrdDir
        echo $FileOwner
        echo $DevFiles
#Then I'll want to do some stuff here......
#Then read in variables in from the second line of list.txt 
#And eventually, third...4th...until it gets to the end of the file.
        done

Keep in mind, I'm just echoing the contents of the variables to the screen so I can see what they contain.  My problem is, when I run the script, I get this..

host1 host1
/directory/on/host1 /anotherdirectory/on/host1
host2 host2
/directory/on/host2 /another/directory/on/host2
fileowner fileowner
somefile anotherfile

Anybody know what I have screwed up?  It's probably something silly, but I can't put my finger on it.
Thanks,
Tim

Offline

#2 2005-05-08 04:03:46

Stinky
Member
From: The Colony, TX
Registered: 2004-05-28
Posts: 187

Re: ksh script question [Solved]

never mind.  I figured it out.

Offline

Board footer

Powered by FluxBB