I am working on a ksh script wherein a table is read in to produce
variables for use on specific files. I am using the cut command to read
specific fields in that table. One of the fields contains unix commands
to be executed on specific files (the ksh script handles several files
with different reformatting requirements). The cut command in question
is:
unix_commands=`echo $line | cut -d":" -f4'
The table entry that echo reads is:
:command $vardir/$varfile.tmp $vardir/tmp.$varfile,command
$vardir/tmp.$varfile $vardir/$varfile.tmp:
(the first "command" reformats the file and outputs it with a new name,
the second "command" performs additional reformatting and restores the
results to the original filename)
The problem is I am not getting the VALUES of $vardir or $varfile, but
am only getting the literal characters "$vardir" and "$varfile". In
other words, the variable $unix_commands, when echoed out, is precisely
the same as the table entry that is read in.
I'm sure this is obvious to your ordinary garden-variety Unix guru, but
that ain't me! ;-)
Obviously, I cannot use the cut command for this function, but am at a
loss as to what I CAN use. Or perhaps I CAN use the cut command, but
have to use some intermediate command to evaluate the values of the
variables before assigning it to a variable I can use later in the
script. Any pointers would be appreciated.
Ron
Sent via Deja.com http://www.deja.com/
Before you buy.