Looking for some help again with my scripting. I'm trying to read a file and for each entry in the file I want to ask the person running if they want to export that table. If they do, I put the table name in a final output file.
the file I'm reading has
book
chapter
case
My part of the script in question has the following:
rm -f finalout.txt
while read tabname;
do
echo 'Do you want to export '${tabname}
echo 'reply Y to export, N to skip'
read ans1
echo ${ans1}
if [ $ans1} = 'Y' ]
then echo $tabname >> finalout.txt
else
echo 'table will not be exported'
fi
done
output.....
Do you want to export book
reply Y to export, N to skip
test4.sh[XX]: test: argument expected (where XX is the line number of the if statement)
Any ideas on this. I have a feeling I cannot use the read within a read, but do not know how else to do it.
thanks
the file I'm reading has
book
chapter
case
My part of the script in question has the following:
rm -f finalout.txt
while read tabname;
do
echo 'Do you want to export '${tabname}
echo 'reply Y to export, N to skip'
read ans1
echo ${ans1}
if [ $ans1} = 'Y' ]
then echo $tabname >> finalout.txt
else
echo 'table will not be exported'
fi
done
output.....
Do you want to export book
reply Y to export, N to skip
test4.sh[XX]: test: argument expected (where XX is the line number of the if statement)
Any ideas on this. I have a feeling I cannot use the read within a read, but do not know how else to do it.
thanks