I am trying to assign variables using the value
of other variables and not getting what I want
can someone point me in the right direction
please?
This is what I have tried:
I have a list of parameters in a file called /home/userid/paramdir/params to process in a new line delimited file as follows:
script1
script2
What I want to happen is for index.html to be printed to /home/userid/first/alpha/param1_target/index.html for the first instance through /home/userid/second/hotel/param5_target/index.html for the last instance. But what I am getting is an attempt to print index.html to ./param1_output through ./param5_output.
I tried using eval as
but ended up with the same results. I am afraid that at this point I am stumped.
Any suggestions will be greatfully received.
Thanks.
Derek.
of other variables and not getting what I want
can someone point me in the right direction
please?
This is what I have tried:
I have a list of parameters in a file called /home/userid/paramdir/params to process in a new line delimited file as follows:
Code:
param1
param2
param3
param4
param5
Code:
#!/bin/ksh
basepath=/home/userid/output
paramdir=/home/userid/paramdir
for test1 in first second
do
if [[ $test1 = "first ]]
then
for test2 in alpha bravo charlie delta
do ${test1}_${$test2}_hold=${basepath}/${test2}/${test2}/out/
# the preceding evaluates as I expect it to
for param in $(cat ${paramdir}/params)
do
script2 $param $test1 $test2
done
done
fi
if [[ $test1 = "second" ]]
then
for test2 in echo foxtrot golf hotel
do
for param in $(cat ${paramdir}/params)
do
script2 $param $test1 $test2
done
done
fi
done
script2
Code:
#!/bin/ksh
param="$1"
test1="$2"
test2="$3"
${param}_output=/home/userid/${test1}/${test2}/${param}_target
if [[ ! -d ${param}_output ]]
then
mkdir -p ${param}_output
#this ends up creating ./param1_output # through ./param5_output
chown userid:groupid ${param}_output
fi
print "Some output" > ${param}_output/index.html
What I want to happen is for index.html to be printed to /home/userid/first/alpha/param1_target/index.html for the first instance through /home/userid/second/hotel/param5_target/index.html for the last instance. But what I am getting is an attempt to print index.html to ./param1_output through ./param5_output.
I tried using eval as
Code:
eval ${param}_output=/home/userid/${test1}/${test2}/${param}_target
Any suggestions will be greatfully received.
Thanks.
Derek.