I am reading a csv file in bash script as follows:
resource='/data/bscs/'
while IFS='|'read seqid fname fpath
do
echo "FILENO: $seqid"
echo "FILENAME: $fname"
echo "FILE_PATH: $fpath"
done < "report.csv"
My csv file has following values :
3|sample1.txt|$resource/operation/
I want the $resource to expand inside $fname. Instead, I am getting this output:
FILENO: 3
FILENAME: sample1.txt
SOURCE PATH: $resource/operation
I have tried the following:
"${fpath}"
$(echo $fpath)
How can I achieve this?
do
eval fpath=$fpath
or exchangeecho "FILE_PATH: $fpath"
byecho "FILE_PATH: ${fpath/\$resource/$resource}"